application component's environment allows the application component to be customized
without the need to access or change the application component's source code.
A Java EE container implements the application component's environment, and provides it to
the application component instance as a JNDI naming context. The application component's
environment is used as follows:
■
The application component's business methods access the environment using the JNDI
interfaces. The application component provider declares in the deployment descriptor all
the environment entries that the application component expects to be provided in its
environment at runtime.
■
The container provides an implementation of the JNDI naming context that stores the
application component environment. The container also provides the tools that allow the
deployer to create and manage the environment of each application component.
■
A deployer uses the tools provided by the container to initialize the environment entries that
are declared in the application component's deployment descriptor. The deployer sets and
modies the values of the environment entries.
■
The container makes the environment naming context available to the application
component instances at runtime. The application component's instances use the JNDI
interfaces to obtain the values of the environment entries.
Each application component denes its own set of environment entries. All instances of an
application component within the same container share the same environment entries.
Application component instances are not allowed to modify the environment at runtime.
Naming References and Binding Information
A resource reference is an element in a deployment descriptor that identies the component’s
coded name for the resource. More specically, the coded name references a connection factory
for the resource. In the example given in the following section, the resource reference name is
jdbc/SavingsAccountDB.
The JNDI name of a resource and the name of the resource reference are not the same. This
approach to naming requires that you map the two names before deployment, but it also
decouples components from resources. Because of this de-coupling, if at a later time the
component needs to access a dierent resource, the name does not need to change. This
exibility also makes it easier for you to assemble J2EE applications from preexisting
components.
The following table lists JNDI lookups and their associated references for the J2EE resources
used by the Enterprise Server.
NamingReferencesandBinding Information
SunGlassFishEnterpriseServer2.1AdministrationGuide • December200878