Support use the @Resource(name="java:global/env/abc") for environment entry
injection
-------------------------------------------------------------------------------------
Key: GERONIMO-6022
URL: https://issues.apache.org/jira/browse/GERONIMO-6022
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: naming
Affects Versions: 3.0
Reporter: Ivan
Assignee: Ivan
Fix For: 3.0
It looks to me that it is nature to use lookup attribute, not the name
attribute, but it will be better that we could inject env-entry with this style.
I went through the related parts in the Java EE 6 spec, and do not find some
explicit descriptions for this, only found the words below. From it, it seems
that it is valid to define environment entry in those sharable namespace, I
could see many ways for using this, e.g. in an ear package, which contains some
wars, ejbs etc.
a. Declare an entry like java:global/env/abc in one war package, and all other
components could use @Resource(name="java:global/env/abc") to inject values.
b. More than one components declare the entry java:global/env/abc with the same
values, it is OK, but fails while the values are different.
c. Declare the entry in the application.xml, other modules just use it.
In current EnvironmentEntryBuilder, it somewhat supports the behaviors above.
But it totally depends on the naming build order of those sub components, if
one component just uses the value is found first, it will be ignored due to no
target value is found.
---> EE 5.2.2
If multiple application components declare an environment entry in one of the
shared namespaces, all attributes of that entry must be identical in each
declaration. For example, if multiple components declare a resource reference
with the same java:app name, the authentication and shareable attributes must
be identical.
If all attributes of each declaration of a shared environment entry are not
identical, this must be reported as a deployment error to the Deployer. The
deployment tool may allow the Deployer to correct the error and continue
deployment.
By default, environment entries declared by application components are
created in the java:comp/env namespace. Environment entries may be declared
in any one of the defined namespaces by explicitly including the namespace
prefix
before the name. It is recommended but not required that environment entries
be
created in the env subcontext of the corresponding naming context. For
example,
entries shared within a module should be declared in the java:module/env
context. Note that names that are not under the env subcontext may conflict
with
the current or future versions of this specification, with server-defined
names,
such as the names of applications or modules, or with server-defined resources.
Names in the env subcontexts of any of the namespaces must only be created by
an explicit declaration in an application or by an explicit action by an
administrator; the application server must not predefine any names in the env
subcontext of any of the namespaces, or in any subcontext of any such env
context.
<---
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira