public class JndiLocatorDelegate extends JndiLocatorSupport
JndiLocatorSupport
subclass with public lookup methods,
for convenient use as a delegate.CONTAINER_PREFIX
logger
Constructor and Description |
---|
JndiLocatorDelegate() |
Modifier and Type | Method and Description |
---|---|
static JndiLocatorDelegate |
createDefaultResourceRefLocator()
Configure a
JndiLocatorDelegate with its "resourceRef" property set to
true , meaning that all names will be prefixed with "java:comp/env/". |
static boolean |
isDefaultJndiEnvironmentAvailable()
Check whether a default JNDI environment, as in a J2EE environment,
is available on this JVM.
|
java.lang.Object |
lookup(java.lang.String jndiName)
Perform an actual JNDI lookup for the given name via the JndiTemplate.
|
<T> T |
lookup(java.lang.String jndiName,
java.lang.Class<T> requiredType)
Perform an actual JNDI lookup for the given name via the JndiTemplate.
|
convertJndiName, isResourceRef, setResourceRef
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
public java.lang.Object lookup(java.lang.String jndiName) throws javax.naming.NamingException
JndiLocatorSupport
If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
lookup
in class JndiLocatorSupport
jndiName
- the JNDI name to look upjavax.naming.NamingException
- if the JNDI lookup failedJndiLocatorSupport.setResourceRef(boolean)
public <T> T lookup(java.lang.String jndiName, java.lang.Class<T> requiredType) throws javax.naming.NamingException
JndiLocatorSupport
If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
lookup
in class JndiLocatorSupport
jndiName
- the JNDI name to look uprequiredType
- the required type of the objectjavax.naming.NamingException
- if the JNDI lookup failedJndiLocatorSupport.setResourceRef(boolean)
public static JndiLocatorDelegate createDefaultResourceRefLocator()
JndiLocatorDelegate
with its "resourceRef" property set to
true
, meaning that all names will be prefixed with "java:comp/env/".public static boolean isDefaultJndiEnvironmentAvailable()
true
if a default InitialContext can be used,
false
if not