The Analysis view shows the EJB's different fields and methodsin the bean class, the home interface, and the EJB's remote interface. The Analysis view is the first UML diagram created when modeling an EJB. The Analysis view includes the EJB's CMP fields, their getter and setter methods, and the create and finder methods. The CMP field types, along with the return type of the methods, are specified with the <<EjbCmpField>> stereotype. The <<EJBRemoteMethod>> stereotype specifies the remote interface methods. The <<EJBBeanMethod>> stereotype specifies the implementation class methods. The <<create>> stereotype specifies the home interface create method. The <<finderMethod>> stereotype specifies the home interface finder methods Figure 6 shows the Analysis View of the example EJB.
Figure 6. The Analysis View.
The External View Class Diagram
Next, you create the external view of the EJB. The external view shows those EJB components that represent the client's viewthe home interface, the remote interface, and the primary key interface. The external view shows the dependencies between the classes and interfaces. The home interface instantiates the remote interface. The return type of both the create method and the findByPrimaryKey methods is the remote interface object. The primary key class is used as the parameter in the findByPrimaryKey method of the home interface. The stereotype <instantiate>> specifies the instantiation of the remote interface from the home interface. The stereotype <<EJBPrimaryKey>> specifies the Primary key as a parameter in the home interface. Figure 4 shows the External View Class Diagram.
Figure 7. The External View Class Diagram.
The Internal View Detail Class Diagram
After creating the Analysis and the External views, you'd next model the internal view of the EJB. The internal view detail shows the implementation detail and mappings between the bean class, the home and remote interfaces, and the primary key class. The stereotypes <EJBRealizeRemote>> and <<EJBRealizeHome>> specify the remote and home interfaces implemented in the bean implementation class. Figures 8 and 9 show the internal view detail.
Figure 8. The Internal View Detail.
Figure 9. The Internal View Detail.
Because a UML model for an EJB may be reviewed and modified according to design requirements, modeling an EJB with UML prior to actually creating an EJB is an efficient method to develop EJBs. I used the Poseidon for UML tool in this tutorial, because it's so commonly used. Another UML modeling tool, such as one of the open source UML modeling tools, can certainly also be used.
JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for
Windows 95, 98, ME, NT, 2000 and XP. It's designed to
automatically optimize your Windows settings, boosting your
Internet connection up to 200%.