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

Sun Microsystems Inc.

Enterprise bean environment

Enterprise JavaBeans 2.0, Public Draft Enterprise bean’s environment as a JNDI nam-

Section 19.3 defines the interfaces for obtaining the home interface of another enterprise bean using an EJB reference. An EJB reference is a special entry in the enterprise bean’s environment.

Section 19.4 defines the interfaces for obtaining a resource manager connection factory using a resource manager connection factory reference. A resource manager connection factory reference is a special entry in the enterprise bean’s environment.

Section 19.5 defines the interfaces for obtaining an administered object that is associated with a resource (e.g., a JMS destination) using a resource environment reference. A resource environment reference is a special entry in the enterprise bean’s environment.

19.2Enterprise bean’s environment as a JNDI naming context

The enterprise bean’s environment is a mechanism that allows customization of the enterprise bean’s business logic during deployment or assembly. The enterprise bean’s environment allows the enterprise bean to be customized without the need to access or change the enterprise bean’s source code.

The Container implements the enterprise bean’s environment, and provides it to the enterprise bean instance through the JNDI interfaces. The enterprise bean’s environment is used as follows:

1.The enterprise bean’s business methods access the environment using the JNDI interfaces. The Bean Provider declares in the deployment descriptor all the environment entries that the enterprise bean expects to be provided in its environment at runtime.

2.The Container provides an implementation of the JNDI naming context that stores the enterprise bean environment. The Container also provides the tools that allow the Deployer to create and manage the environment of each enterprise bean.

3.The Deployer uses the tools provided by the Container to create the environment entries that are declared in the enterprise bean’s deployment descriptor. The Deployer can set and modify the values of the environment entries.

4.The Container makes the environment naming context available to the enterprise bean instances at runtime. The enterprise bean’s instances use the JNDI interfaces to obtain the values of the environment entries.

Each enterprise bean defines its own set of environment entries. All instances of an enterprise bean within the same home share the same environment entries; the environment entries are not shared with other enterprise beans. Enterprise bean instances are not allowed to modify the bean’s environment at runtime.

If an enterprise bean is deployed multiple times in the same Container, each deployment results in the creation of a distinct home. The Deployer may set different values for the enterprise bean environment entries for each home.

5/31/00

380