Actions
JNDI Support¶
Components in the z2-Environment may be looked up via the Java Naming and Directory Interface (JNDI).
The functionality is essentially equivalent to lookups via the IComponentsLookup (LINK) interface.
When looking up a component via z2, it is required to specify the expected return type. Using JNDI this can be accomplished by specifying a type query parameter in the JNDI URL. For example, when looking up a JDBC data source that is declared in a component repository as the component mymodule/dataSource
, the call
IComponentsLookup.INSTANCE.lookup("mymodule/dataSource",javax.sql.DataSource.class);
is equivalent to
new InitialContext().lookup("components:mymodule/dataSource?type=javax.sql.DataSource");
If no type parameter is specified, the JNDI lookup will be treated as a z2 component lookup for the type java.lang.Object
.
Updated by Henning Blohm over 9 years ago · 1 revisions