EG has posted 15 posts at DZone. View Full User Profile

Jt - Java Pattern Oriented Framework (Jt 3.2)

02.03.2009
| 1759 views |
  • submit to reddit

Jt3.2 has been released. Jt is a pattern oriented framework for the rapid implementation of Java applications. Jt has been utilized in several large mission critical systems. Jt implements many well-known patterns including Data Access Objects (DAO), GoF design patterns and J2EE patterns.

The framework addresses the following goals and requirements:

  • The pattern oriented framework implements and facilitates the implementation of well-known design patterns like GoF design patterns and J2EE Design patterns. The framework itself is conceived and implemented based on design patterns (from the ground up). The framework facilitates and accelerates the implementation of applications based on design patterns.
  • The framework architecture is based on a messaging design pattern: framework objects are able to interchange information and perform computations by sending, receiving and processing messages. A messaging API provides strong encapsulation and loose coupling; framework components can be easily plugged into complex framework applications using a “lego/messaging” architecture. The framework takes full advantage of the power and simplicity of the messaging design pattern.
  • The framework lego/messaging architecture provides transparent access to remote components: remote framework objects is treated as local objects. Design patterns implemented by the framework (adapters, remote proxies and facades) make this posible by hiding the complexities associated with remote APIs.
  • The framework provides transparent integration with other technologies via framework adapters, proxies and the implementation of related design patterns. These technologies include BPM, DAO implementations, MVC implementations, EJBs, JMS, XML and Web Services.
  • The framework is designed to be lightweight and fast in terms of performance (low overhead).
  • The framework messaging/lego architecture should improve and simplify design/development efforts. There should be a tight correspondence between UML design diagrams and the framework messaging based applications and components needed for the implementation. Ideally, the framework provides wizards and automated capabilities for generating framework applications. Framework components should be easily added to BPM process diagrams. In future versions of the framework, it should be possible for applications to be generated directly from the UML design diagrams.
  • The framework messaging architecture facilitates testing and debugging efforts. The framework provides capabilities for testing components independently (each component as a unit) by sending messages and verifying the reply (output) messages.
  • In order to provide additional productivity benefits, the framework is integrated with open source IDEs. 

For additional information please refer to http://freedom.lunarpages.com/Jt . You can join the Jt mailing list there.


Web services can be easily integrated within Jt 3.2. A universal Web service adapter (JtWebServiceAdapter) provides a transparent interface between the Jt framework API and Web Services. The familiar Jt messaging API used to create and manipulate local framework objects still applies. Remote framework objects are treated as local objects. This section is based on the Apache Axis Web services implementation. The following simple steps are needed in order to invoke web services:

  • Use a deployment descriptor to deploy the Jt Axis service (JtAxisService). The Jt Framework and Apache Axis need to be installed before performing this step.
  • Create an instance of the Jt Web Services Adapter (JtWebServiceAdapter). Set the service URL attribute.
  • Use the JtWebServiceAdapter instance to create a proxy. This local proxy is used to manipulate remote components.

 

The Jt Web Services Adapter communicates with the Jt Axis Service via XML messages. The Jt Web Services Adapter converts Jt API calls into XML messages. These messages are passed to the Jt Axis service for processing: remote Jt Framework objects can be created, manipulated and removed. An XML reply is returned. The Jt Web Service adapter converts the XML reply into an object on behalf of the client application.

Using the Jt Web Services Adapter

Complete examples can be found under the source directory (Jt.axis.JtWebServicesAdapter and Jt.examples.WebServicesExample). The usual Jt messaging API is used to create and manipulate remote objects via the Jt Web Services Adapter. A local proxy is returned by the web services adapter. This proxy contains a reference to the remote object. The usual Jt messaging API can be used to manipulate the remote object via its proxy.

public static void main(String[] args) {JtObject factory = new JtFactory ();JtWebServicesAdapter adapter;String reply = null;Exception ex;JtMessage msg;JtProxy proxy;// Create the Jt Web service Adapteradapter = (JtWebServicesAdapter) factory.createObject (JtWebServicesAdapter.JtCLASS_NAME);// Set the service url property (if it is not present in the resource file)if (adapter.getUrl() == null)adapter.setUrl("http://localhost:8080/axis/services/JtAxisService");// Create a remote instance of the HelloWorld class. The Jt Web service adapter// can be used to create remote instances of framework objects. A local// proxy is returned.msg = new JtMessage (JtWebServicesAdapter.JtCREATE_PROXY);msg.setMsgContent(HelloWorld.JtCLASS_NAME);proxy = (JtProxy) factory.sendMessage (adapter, msg);factory.setValue (proxy, "greetingMessage", "Hello there...");msg = new JtMessage (HelloWorld.JtHELLO);// Send JtHello to the remote helloWorld objectreply = (String) factory.sendMessage (proxy, msg);// Display the reply unless an exception is detected.// The remote exception gets propagated from the// remote object to the local proxyex = (Exception) proxy.getObjException();if (ex == null) System.out.println (reply);// Remove the remote instance and the adapterfactory.removeObject (proxy);factory.removeObject(adapter);}package Jt.examples;/*** Demonstrates the use of the Jt Web Service Adapter (JtWebServicesAdapter). */public class WebServicesExample {private static final long serialVersionUID = 1L;public static final String GET_DATE = "GET_DATE"; public static final String GET_DATE_TIME = "GET_DATE_TIME"; public WebServicesExample () {}public static void main(String[] args) {JtObject factory = new JtObject ();JtWebServicesAdapter adapter;Date reply = null;Exception ex;JtMessage msg;JtList col;JtIterator iterator = null;Long time;JtProxy proxy;// Create the Jt Web service Adapteradapter = (JtWebServicesAdapter) factory.createObject (JtWebServicesAdapter.JtCLASS_NAME, "service");// Set the service url property (if it is not present in the resource file)if (adapter.getUrl() == null)adapter.setUrl("http://localhost:8080/axis/services/JtAxisService");// Create a remote instance of the DateService class. The Jt Web service adapter// can be used to create remote objects. A local proxy is returned.msg = new JtMessage (JtWebServicesAdapter.JtCREATE_PROXY);msg.setMsgContent("Jt.examples.DateService");proxy = (JtProxy) factory.sendMessage (adapter, msg); // Send a message to the remote DateService object reply = (Date) factory.sendMessage (proxy, new JtMessage (WebServicesExample.GET_DATE));ex = (Exception) proxy.getObjException();// Display the if (ex == null) System.out.println ("Date:" + reply);// Remove the remote object and the adapter instanceadapter.removeObject (proxy);factory.removeObject(adapter);}}



Additional features include:

* Implemented J2EE design patterns include J2EE business delegate, J2EE Session Facade, J2EE Service Locator and J2EE Value Object.
* Web Services integration via the implementation of Web Services adapters and proxies. The Jt messaging API greatly simplifies the development and deployment of web services.
* Integration with business process modeling (BPM). A jBPM adapter is provided within the Jt framework. jBPM is an open source implementation of the BPM technology. A Jt application can now be modeled using a process graph. This provides users with a very powerful way of modeling business processes.
* Integration with the MVC (Model View Controller) design pattern and Ajax. Universal Jt components and adapters provide a transparent interface between the Jt framework API and these technologies. The business logic (controller piece) can be implemented using Jt framework components and/or BPM business processes.
* Integration with the Hibernate implementation of Data Access Objects (DAO). A Jt adapter provides a transparent interface between the Jt framework and Hibernate DAOs. A native Jt DAO implementation is also provided. Additional DAO strategies can be easily plugged in.
* JDBC integration via a JDBC adapter.
* The Command pattern implementation supports a request log, a queueing mechanism and undoable operations.
* JavaMail API integration via the implementation of a JavaMail adapter
* Integration with J2EE Enterprise Java Beans (EJBs) via Jt Adapters and proxies. EJB clients are able to gain transparent access to remote framework objects. No need to deal with the complexities of EJB application development. An implementation of the J2EE Service Locator pattern is also provided.
* Easy customization of framework applications. This is done via resource files: object attributes can be automatically loaded from a resource file.
* Java Server Pages (JSP) integration.
* Integration with the XML APIs via XML adapters, helpers and built-in bean/XML mapping capabilities.
* Integration with the asynchronous Java Message Service (JMS). Jt messages can be sent and received via JMS adapters.
* Built-in logging/debugging capabilities. Messages between framework objects are automatically logged. This simplifies the debugging and testing tasks.
* Built-in testing capabilities.
* Efficient and lightweight in terms of memory utilization.
* The framework can be easily extended by implementing additional Jt adapters and helpers.
* The Jt Framework provides a consistent way of handling and logging application messages, errors and exceptions.
* Proven technology. The Jt framework has been used for the development of several large enterprise applications.
* Cross-platform, implemented using JavaTM technology.
* Integration with the Eclipse environment.
* Runs on any J2EE compatible application server.

 

 

0
Published at DZone with permission of its author, EG .

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)