Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, v1.1 - Sun Microsystems.pdf
Скачиваний:
11
Добавлен:
24.05.2014
Размер:
1.62 Mб
Скачать

Sun Microsystems Inc.

Session Bean Component Contract

Enterprise JavaBeans v1.1, Final Release The responsibilities of the container provider

6.11 The responsibilities of the container provider

This section describes the responsibilities of the container provider to support a session bean. The container provider is responsible for providing the deployment tools and for managing the session bean instances at runtime.

Because the EJB specification does not define the API between deployment tools and the container, we assume that the deployment tools are provided by the container provider. Alternatively, the deployment tools may be provided by a different vendor who uses the container vendor’s specific API.

6.11.1 Generation of implementation classes

The deployment tools provided by the container are responsible for the generation of additional classes when the session bean is deployed. The tools obtain the information that they need for generation of the additional classes by introspecting the classes and interfaces provided by the enterprise bean provider and by examining the session bean’s deployment descriptor.

The deployment tools must generate the following classes:

A class that implements the session bean’s home interface (session EJBHome class).

A class that implements the session bean’s remote interface (session EJBObject class).

The deployment tools may also generate a class that mixes some container-specific code with the session bean class. This code may, for example, help the container to manage the bean instances at runtime. The tools can use subclassing, delegation, and code generation.

The deployment tools may also allow the generation of additional code that wraps the business methods and is used to customize the business logic to an existing operational environment. For example, a wrapper for a debit function on the AccountManager bean may check that the debited amount does not exceed a certain limit.

6.11.2 Session EJBHome class

The session EJBHome class, which is generated by the deployment tools, implements the session bean’s home interface. This class implements the methods of the javax.ejb.EJBHome interface and the create methods specific to the session bean.

The implementation of each create(...

) method invokes a matching ejbCreate(...

)

method.

 

 

6.11.3 Session EJBObject class

The Session EJBObject class, which is generated by the deployment tools, implements the session bean’s remote interface. It implements the methods of the javax.ejb.EJBObject interface and the business methods specific to the session bean.

11/24/99

78

Sun Microsystem Inc

The responsibilities of the container provider Enterprise JavaBeans v1.1, Final Release

Session Bean Component Contract

The implementation of each business method must activate the instance (if the instance is in the passive state) and invoke the matching business method on the instance.

6.11.4 Handle classes

The deployment tools are responsible for implementing the handle classes for the session bean’s home and remote interfaces.

6.11.5 EJBMetaData class

The deployment tools are responsible for implementing the class that provides meta-data to the client view contract. The class must be a valid RMI Value class and must implement the javax.ejb.EJBMetaData interface.

6.11.6 Non-reentrant instances

The container must ensure that only one thread can be executing an instance at any time. If a client request arrives for an instance while the instance is executing another request, the container must throw the java.rmi.RemoteException to the second request.

Note that a session object is intended to support only a single client. Therefore, it would be an application error if two clients attempted to invoke the same session object.

One implication of this rule is that an application cannot make loopback calls to a session bean instance.

6.11.7 Transaction scoping, security, exceptions

The container must follow the rules with respect to transaction scoping, security checking, and exception handling, as described in Chapters 11, 15, and 12, respectively.

79

11/24/99

Sun Microsystems Inc.

Session Bean Component Contract

Enterprise JavaBeans v1.1, Final Release The responsibilities of the container provider

11/24/99

80