|
Javelin: the JDJ 'World Class Award' winning, leader in visual, model driven Java development since 1996! |
Javelin
Evaluation try it FREE for 15 days and realize the benefits and efficiencies of managing a POJO based domain model via live class diagrams instead of a plethura of text files. Read more>> |
exPOJO: feedback, contributions, questions,
suggestions:
|
![]() |
![]() |
expose your POJOs! |
exPOJO is a framework that allows you to 'expose your POJOs' via the Exposed Domain Model pattern. The key classes in the framework are described on this page. The tutorial takes you step by step through the process of the exPOJOnization of your application.
The ModelExposer class defines the central, per session, 'model exposing' object that makes available the service and repository objects that your application requires (see below for more details on services and respositories). It is not necessary to override this class in your applications. In a J2EE environment an instance of the ModelExposer class is automatically instantiated for during the creation user session via the exPOJO servlet filter. At the start of each request the session's ModelExposer is automatically associated with the current thread and thus available via the static method ModelExposer.get(). After processing each request the ModelExposer is detached from the thread. Virtually all persistence facilities required by your application are automatically encapulated within the ModelExposer object and its services and repositories.
The superclass for all repository classes. Override this to define your own repository class(es). These will be added to the ModelExposer and thus accessible from anywhere.
The superclass for all service classes. Override this to define your own service class(es). These will be added to the ModelExposer and thus accessible from anywhere.
ExpojoServletContextListener is resposible for constructing ModelExposer objects as required. Your application must contain a class that extends ExpojoServletContextListener and overrides the addComponents method. This method is called whenever a new ModelExposer is instantiated and it is responsible for adding any required repository and service components to the ModelExposer that are required by your application.
You must also override the createPersistenceProviderFactory method to create the persistence provider factory appropriate to your persistence engine - see below.
The PersistenceProvider superclass abstracts the behaviour of persistence providers to provide a generic interface to persistence functionality regardless of the persistence technology used (JDO, Hibernate or in the future perhaps JPA). Specialized PersistenceProvider derived classes implement the persistence of vendor specific persistence provider classes: a Session in Hibernate Session and a PersistenceManager in JDO. A ModelExposer holds a reference to its own PersistenceProvider that it obtains from the PersistenceProviderFactory at initialization. Model objects rarely need to access the PersistenceProvider directly but Repository classes need it to perform persistence technology specific queries. Service classes will require access to it on rare occasions.
You don't normally need to derive from or instantiate a PersistenceProvider. Its use is mainly transparent.
The PersistenceProviderFactory class has been overridden in the exPOJO framework to implement factories that create PersistenceProviders for the various technologies. You will rarely need to change these. You will, however, need to instantiate the appropriate factory by overriding ExpojoServletContextListener.createPersistenceProviderFactory.
exPOJO currently has working factories for:
exPOJO can easily be enhanced to support other persistence technologies as they evolve.
home | Javelin Home | Visual Classworks Home
Custom software development services
Copyright ©
1996, 2007 Step Ahead Software Pty Ltd. All rights reserved.
Java™ and Java™-based marks are trademarks or registered trademarks of Sun
Microsystems.
Flash™ is a trade mark of Macromedia Inc.