EJB.8.2 EJB Container


An EJB container (container for short) is a system that functions as a runtime container for enterprise beans.

Multiple enterprise beans can be deployed in a single container. For each entity bean deployed in a container, the container provides a home interface that allows the client to create, find, and remove entity objects that belong to the entity bean. The container makes the entity beans' home interfaces (defined by the bean provider and implemented by the container provider) available in the JNDI API name space for clients .

An EJB server may host one or multiple EJB containers. The containers are transparent to the client: There is no client API to manipulate the container, and there is no way for a client to tell in which container an enterprise bean is installed.

EJB.8.2.1 Locating an Entity Bean's Home Interface

A client locates an entity bean's home interface using JNDI. For example, the home interface for the Account entity bean can be located using the following code segment:

 Context initialContext = new InitialContext();  AccountHome accountHome = (AccountHome)       javax.rmi.PortableRemoteObject.narrow(            initialContext.lookup("java:comp/env/ejb/accounts"),                              AccountHome.class); 

A client's JNDI name space may be configured to include the home interfaces of enterprise beans deployed in multiple EJB containers located on multiple machines on a network. The actual location of an EJB container is, in general, transparent to the client.

EJB.8.2.2 What a Container Provides

Figure EJB.8-1 illustrates the view that a container provides to the clients of the entity beans deployed in the container.

Figure EJB.8-1. Client View of Entity 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