|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jndi.JndiAccessor org.springframework.jndi.JndiLocatorSupport org.springframework.jndi.JndiObjectLocator org.springframework.jndi.AbstractJndiLocator
Convenient superclass for JNDI-based service locators. Subclasses are JavaBeans, exposing a "jndiName" property. This 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 like "java:" is given.
Subclasses must implement the located
method to cache the
results of the JNDI lookup. They don't need to worry about error handling.
Assumptions: The resource obtained from JNDI can be cached.
Subclasses will often be used as singletons in a bean container. This sometimes presents a problem if that bean container pre-instantiates singletons, since this class does the JNDI lookup in its init method, but the resource being pointed to may not exist at that time, even though it may exist at the time of first usage. The solution is to tell the bean container not to pre-instantiate this object (i.e. lazily initialize it instead).
located(java.lang.Object)
,
JndiObjectLocator
Field Summary |
Fields inherited from class org.springframework.jndi.JndiLocatorSupport |
CONTAINER_PREFIX |
Fields inherited from class org.springframework.jndi.JndiAccessor |
logger |
Constructor Summary | |
AbstractJndiLocator()
Deprecated. |
Method Summary | |
void |
afterPropertiesSet()
Deprecated. Check the "jndiName" property and initiate a lookup. |
protected abstract void |
located(Object jndiObject)
Deprecated. Subclasses must implement this to cache the object this class has obtained from JNDI. |
protected Object |
lookup()
Deprecated. Perform the actual JNDI lookup via the JndiTemplate. |
Methods inherited from class org.springframework.jndi.JndiObjectLocator |
getJndiName, setJndiName |
Methods inherited from class org.springframework.jndi.JndiLocatorSupport |
convertJndiName, isResourceRef, lookup, setResourceRef |
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 |
Constructor Detail |
public AbstractJndiLocator()
Method Detail |
public void afterPropertiesSet() throws NamingException
The JNDI object will thus be fetched eagerly on initialization.
For refreshing the JNDI object, subclasses can invoke lookup
at any later time.
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class JndiObjectLocator
NamingException
lookup()
protected Object lookup() throws NamingException
located
method after successful lookup.
lookup
in class JndiObjectLocator
NamingException
- if the JNDI lookup failedlocated(java.lang.Object)
protected abstract void located(Object jndiObject)
jndiObject
- object successfully retrieved from JNDI
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |