|
|||||||||
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
org.springframework.jndi.JndiObjectLocator
public abstract class JndiObjectLocator
Convenient superclass for JNDI-based service locators, providing configurable lookup of a specific JNDI resource.
Exposes a "jndiName"
property. This may or may not
include the "java:comp/env/" prefix expected by J2EE applications when
accessing a locally mapped (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.
Subclasses may invoke the lookup()
method whenever it is appropriate.
Some classes might do this on initialization, while others might do it
on demand. The latter strategy is more flexible in that it allows for
initialization of the locator before the JNDI object is available.
setJndiName(java.lang.String)
,
JndiAccessor.setJndiTemplate(org.springframework.jndi.JndiTemplate)
,
JndiAccessor.setJndiEnvironment(java.util.Properties)
,
JndiLocatorSupport.setResourceRef(boolean)
,
lookup()
Field Summary | |
---|---|
private java.lang.Class<?> |
expectedType
|
private java.lang.String |
jndiName
|
Fields inherited from class org.springframework.jndi.JndiLocatorSupport |
---|
CONTAINER_PREFIX |
Fields inherited from class org.springframework.jndi.JndiAccessor |
---|
logger |
Constructor Summary | |
---|---|
JndiObjectLocator()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
java.lang.Class<?> |
getExpectedType()
Return the type that the located JNDI object is supposed to be assignable to, if any. |
java.lang.String |
getJndiName()
Return the JNDI name to look up. |
protected java.lang.Object |
lookup()
Perform the actual JNDI lookup for this locator's target resource. |
void |
setExpectedType(java.lang.Class<?> expectedType)
Specify the type that the located JNDI object is supposed to be assignable to, if any. |
void |
setJndiName(java.lang.String jndiName)
Specify the JNDI name to look up. |
Methods inherited from class org.springframework.jndi.JndiLocatorSupport |
---|
convertJndiName, isResourceRef, lookup, 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 |
Field Detail |
---|
private java.lang.String jndiName
private java.lang.Class<?> expectedType
Constructor Detail |
---|
public JndiObjectLocator()
Method Detail |
---|
public void setJndiName(java.lang.String jndiName)
jndiName
- the JNDI name to look upJndiLocatorSupport.setResourceRef(boolean)
public java.lang.String getJndiName()
public void setExpectedType(java.lang.Class<?> expectedType)
public java.lang.Class<?> getExpectedType()
public void afterPropertiesSet() throws java.lang.IllegalArgumentException, javax.naming.NamingException
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
java.lang.IllegalArgumentException
javax.naming.NamingException
protected java.lang.Object lookup() throws javax.naming.NamingException
javax.naming.NamingException
- if the JNDI lookup failed or if the
located JNDI object is not assigable to the expected typesetJndiName(java.lang.String)
,
setExpectedType(java.lang.Class>)
,
JndiLocatorSupport.lookup(String, Class)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |