EJB.7.2 Inheritance Relationship


An example of the inheritance relationship between the interfaces and classes is illustrated in Figure EJB.7-1.

Figure EJB.7-1. Example of Inheritance Relationships Between EJB Classes

EJB.7.2.1 What the Session Bean Provider Is Responsible For

Wombat Inc. is responsible for providing the following:

  • Define the session bean's remote interface ( Cart ). The remote interface defines the business methods callable by a client. The remote interface must extend the javax.ejb.EJBObject interface, and follow the standard rules for an RMI-IIOP remote interface. The remote interface must be defined as public.

  • Write the business logic in the session bean class ( CartBean ). The enterprise bean class may, but is not required to, implement the enterprise bean's remote interface ( Cart ). The enterprise bean must implement the javax.ejb.SessionBean interface, and define the ejbCreate(...) methods invoked at an EJB object creation.

  • Define a home interface ( CartHome ) for the enterprise bean. The home interface must be defined as public, extend the javax.ejb.EJBHome interface, and follow the standard rules for RMI-IIOP remote interfaces.

  • Define a deployment descriptor specifying any declarative metadata that the session bean provider wishes to pass with the bean to the next stage of the development/deployment workflow.

EJB.7.2.2 Classes Supplied by Container Provider

The following classes are supplied by the container provider Acme Corp:

  • The AcmeHome class provides the Acme implementation of the javax.ejb.EJBHome methods.

  • The AcmeRemote class provides the Acme implementation of the javax.ejb.EJBObject methods.

  • The AcmeBean class provides additional state and methods to allow Acme's container to manage its session bean instances. For example, if Acme's container uses an LRU algorithm, then AcmeBean may include the clock count and methods to use it.

  • The AcmeMetaData class provides the Acme implementation of the javax.ejb.EJBMetaData methods.

EJB.7.2.3 What the Container Provider Is Responsible For

The tools provided by Acme Corporation are responsible for the following:

  • Generate the class ( AcmeRemoteCart ) that implements the session bean's remote interface. The tools also generate the classes that implement the communication protocol specific artifacts for the remote interface.

  • Generate the implementation of the session bean class suitable for the Acme container ( AcmeCartBean ). AcmeCartBean includes the business logic from the CartBean class mixed with the services defined in the AcmeBean class. Acme tools can use inheritance, delegation, and code generation to achieve a mix-in of the two classes.

  • Generate the class ( AcmeCartHome ) that implements the session bean's home interface. The tools also generate the classes that implement the communication protocol specific artifacts for the home interface.

  • Generate the class ( AcmeCartMetaData ) that implements the javax.ejb.EJBMetaData interface for the Cart bean.

Many of the above classes and tools are container-specific (i.e., they reflect the way Acme Corp implemented them). Other container providers may use different mechanisms to produce their runtime classes, and these classes will likely be different from those generated by Acme's tools.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net