EJB.5.2 EJB Container


An EJB container (container for short) is a system that functions as the "container" for enterprise beans. Multiple enterprise beans can be deployed in the same container. The container is responsible for making the home interfaces of its deployed enterprise beans available to the client through JNDI API extension. Thus, the client can look up the home interface for a specific enterprise bean using JNDI API.

EJB.5.2.1 Locating a Session Bean's Home Interface

A client locates a session bean's home interface using JNDI API. For example, the home interface for the Cart session bean can be located using the following code segment:

 Context initialContext = new InitialContext();  CartHome cartHome = (CartHome)javax.rmi.PortableRemoteObject.narrow(    initialContext.lookup("java:comp/env/ejb/cart"),     CartHome.class); 

A client's JNDI name space may be configured to include the home interfaces of enterprise beans installed in multiple EJB containers located on multiple machines on a network. The actual locations of an enterprise bean and EJB container are, in general, transparent to the client using the enterprise bean.

The life cycle of the distributed object implementing the home interface (the EJBHome object) is container-specific. A client application should be able to obtain a home interface, and then use it multiple times, during the client application's lifetime.

A client can pass a home interface object reference to another application. The receiving application can use the home interface in the same way that it would use a home interface object reference obtained via JNDI API.

EJB.5.2.2 What a Container Provides

Figure EJB.5-1 illustrates the view that a container provides to clients of session beans.

Figure EJB.5-1. Client View of Session Beans Deployed in a Container



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