applicationcomponent's environment allows the application component to be customized
withoutthe need to access or change the application component's source code.
AJava EE container implements the application component's environment, and provides it to
theapplication component instance as a JNDI naming context. The application component's
environmentis used as follows:
Theapplication component's business methods access the environment using the JNDI
interfaces.The application component provider declares in the deployment descriptor all
theenvironment entries that the application component expects to be provided in its
environmentat runtime.
Thecontainer provides an implementation of the JNDI naming context that stores the
applicationcomponent environment. The container also provides the tools that allow the
deployerto create and manage the environment of each application component.
Adeployer uses the tools provided by the container to initialize the environment entries that
aredeclared in the application component's deployment descriptor. The deployer sets and
modiesthe values of the environment entries.
Thecontainer makes the environment naming context available to the application
componentinstances at runtime. The application component's instances use the JNDI
interfacesto obtain the values of the environment entries.
Eachapplication component denes its own set of environment entries. All instances of an
applicationcomponent within the same container share the same environment entries.
Applicationcomponent instances are not allowed to modify the environment at runtime.
Naming Referencesand Binding Information
Aresource reference is an element in a deployment descriptor that identies the component’s
codedname for the resource. More specically, the coded name references a connection factory
forthe resource. In the example given in the following section, the resource reference name is
jdbc/SavingsAccountDB.
TheJNDI name of a resource and the name of the resource reference are not the same. This
approachto naming requires that you map the two names before deployment, but it also
decouplescomponents from resources. Because of this de-coupling, if at a later time the
componentneeds to access a dierent resource, the name does not need to change. This
exibilityalso makes it easier for you to assemble J2EE applications from preexisting
components.
Thefollowing table lists JNDI lookups and their associated references for the J2EE resources
usedby the Enterprise Server.
NamingReferencesand Binding Information
SunGlassFishEnterprise Ser ver2.1 Administration Guide • December 200878