JeeWiz Home  
The Model-Driven System Builder

JeeWiz Architect's Guide
 
Contents  >   9.  Patterns
 


9.7 Classes Generated For Each Entity by the J2EE Maintenance Patterns

The following classes are generated by the standard patterns for a single entity object named X.

 9.7.1  The Persistence Tier Classes
 9.7.2  The Service Tier Classes
 9.7.3  The Presentation Tier Classes
 9.7.4  Diagram of the Generated Classes

9.7.1  The Persistence Tier Classes

XProxy is the EJB entity bean. Methods implemented are the standard getters and setters. There are also calls out to the business methods which sit in XBase. Two interfaces are created LocalX and LocalXHome to fulfil the requirements of a J2EE EJB.

XBase contains the extra methods or method stubs depending on whether the method is implemented in the base. For those methods not implemented in the base, the method stubs in XBase call skeleton methods in the implementation class X. Standard methods are implemented in base.

Of course, entities have very few extra methods (over and above the getters and setters), typically just queries, but some standard CRUD methods are also implemented to handle "whole entity" functionality. Which in turn brings us to . . .

XInfo, a value object encapsulating attributes for the entity allowing an entire record to be updated, created, viewed etc. This is what gets passed to and from the entity layer.

XLocalDelegate, is a class sitting in front of the bean (which it accesses through the local interfaces). This class implements an interface call IXLocalDelegate which provides a standard interface to the persistence layer.

To access a particular record, XLocalDelegateFactory can be used to create a record from a value object (XInfo) and return the XLocalDelegate pointing to the underlying bean. Or it can return the results of query method as a XLocalDelegate pointing to the underlying object.

Both the LocalDelegate and the LocalDelegateFactory throw unexpected exception errors called XLocalDelegate$UnexpectedException and XLocalDelegateFactory$UnexpectedException respectively.


9.7.2  The Service Tier Classes

The patterns generate a data view, which in turn generates a maintenance session and several pages. The pages will be dealt with in the presentation layer section next.

The data view is called XDataView. Because data views do not necessarily mimic the underlying entity (even though they do in the case of an automatically generated data view), they have their own value objects. The value object is called XDataViewInfo, which is used to encapsulate the data view fields and relations and is used to pass values between the presentation layer and the service layer, as well as within the service layer.

The data view generates a Session object, which is implemented as a Session EJB called XDataViewMaintenanceSessionProxy. Like XProxy, the session bean calls out to methods on a base class, XDataViewMaintenanceSessionBase, which may in turn contain stubs pointing to skeletons in the XDataViewMaintenanceSession implementation class. Again the standard generated methods are implemented in base. The bean implements all four j2ee bean interfaces, LocalXDataViewMaintenanceSessionHome, LocalXDataViewMaintenanceSession, RemoteXDataViewMaintenanceSessionHome and RemoteXDataViewMaintenanceSession.

Local and Remote delegates are provided to access the session object through the relevant interfaces, called XDataViewMaintenanceSessionRemoteDelegate and XDataViewMaintenanceSessionLocalDelegate. But, unlike the entity delegate, these do not implement interfaces, nor are instances created and returned by a factory class. It assumed that these session objects are stateless.

Both the remote and local delegates throw unexpected exceptions: XDataViewMaintenanceSessionRemoteDelegate$UnexpectedException and XDataViewMaintenanceSessionLocalDelegate$UnexpectedException, respectively.


9.7.3  The Presentation Tier Classes

Several pages are created to allow for the maintenance of the entity, each is backed by a struts action class:
XDataView_createXDataViewAction, a page used to handle http requests in the context of record creation on the entity
XDataView_displayXDataViewAction, a page used to handle http requests in the context of viewing and updating a single entity record
XDataView_readXDataViewAction, a page used to handle http requests in the context of accepting search strings with a view to returning matching rows
XDataView_selectXDataViewAction, a page used to handle http requests in the context of a multirow display.

A struts action form is created XDataViewForm, which is used to encapsulate and pass data within the presentation layer.

The split between an action class and an implementation class is similar for events on the page to the base-implementation split for methods on an entity or a session object, but the implementation class (normally given the same name as the page) is not created for a page when there are no methods handled by programmed code. So unlike the generation of implementation classes for entities and sessions, no implementation classes are generated by the standard patterns.

Jsps and servlets are also automatically generated for the pages.


9.7.4  Diagram of the Generated Classes


 


Copyright (c) 2001-2008 New Technology/enterprise Ltd.