|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.jndi.JndiAccessor
org.springframework.jndi.JndiLocatorSupport
public abstract class JndiLocatorSupport
Convenient superclass for classes that can locate any number of JNDI objects. Derives from JndiAccessor to inherit the "jndiTemplate" and "jndiEnvironment" bean properties.
JNDI names may or may not include the "java:comp/env/" prefix expected by J2EE applications when accessing a locally mapped (ENC - Environmental Naming Context) resource. If it doesn't, the "java:comp/env/" prefix will be prepended if the "resourceRef" property is true (the default is false) and no other scheme (e.g. "java:") is given.
JndiAccessor.setJndiTemplate(org.springframework.jndi.JndiTemplate)
,
JndiAccessor.setJndiEnvironment(java.util.Properties)
,
setResourceRef(boolean)
Field Summary | |
---|---|
static java.lang.String |
CONTAINER_PREFIX
JNDI prefix used in a J2EE container |
private boolean |
resourceRef
|
Fields inherited from class org.springframework.jndi.JndiAccessor |
---|
logger |
Constructor Summary | |
---|---|
JndiLocatorSupport()
|
Method Summary | ||
---|---|---|
protected java.lang.String |
convertJndiName(java.lang.String jndiName)
Convert the given JNDI name into the actual JNDI name to use. |
|
boolean |
isResourceRef()
Return whether the lookup occurs in a J2EE container. |
|
protected java.lang.Object |
lookup(java.lang.String jndiName)
Perform an actual JNDI lookup for the given name via the JndiTemplate. |
|
protected
|
lookup(java.lang.String jndiName,
java.lang.Class<T> requiredType)
Perform an actual JNDI lookup for the given name via the JndiTemplate. |
|
void |
setResourceRef(boolean resourceRef)
Set whether the lookup occurs in a J2EE container, i.e. |
Methods inherited from class org.springframework.jndi.JndiAccessor |
---|
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONTAINER_PREFIX
private boolean resourceRef
Constructor Detail |
---|
public JndiLocatorSupport()
Method Detail |
---|
public void setResourceRef(boolean resourceRef)
Note: Will only get applied if no other scheme (e.g. "java:") is given.
public boolean isResourceRef()
protected java.lang.Object lookup(java.lang.String jndiName) throws javax.naming.NamingException
If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
jndiName
- the JNDI name to look up
javax.naming.NamingException
- if the JNDI lookup failedsetResourceRef(boolean)
protected <T> T lookup(java.lang.String jndiName, java.lang.Class<T> requiredType) throws javax.naming.NamingException
If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
jndiName
- the JNDI name to look uprequiredType
- the required type of the object
javax.naming.NamingException
- if the JNDI lookup failedsetResourceRef(boolean)
protected java.lang.String convertJndiName(java.lang.String jndiName)
The default implementation applies the "java:comp/env/" prefix if "resourceRef" is "true" and no other scheme (e.g. "java:") is given.
jndiName
- the original JNDI name
CONTAINER_PREFIX
,
setResourceRef(boolean)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |