|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.interface21.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. If it doesn't, it will be prepended.
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.
| Field Summary | |
static java.lang.String |
CONTAINER_PREFIX
JNDI prefix used in a J2EE container |
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
AbstractJndiLocator()
Create a new JNDI locator. |
|
AbstractJndiLocator(java.lang.String jndiName)
Create a new JNDI locator, specifying the JNDI name. |
|
| Method Summary | |
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied. |
java.lang.String |
getJndiName()
Return the JNDI name to look up. |
JndiTemplate |
getJndiTemplate()
Return the JNDI template to use for the JNDI lookup. |
boolean |
isInContainer()
Return if the lookup occurs in a J2EE container. |
protected abstract void |
located(java.lang.Object o)
Subclasses must implement this to cache the object this class has obtained from JNDI. |
void |
setInContainer(boolean inContainer)
Set if the lookup occurs in a J2EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI name doesn't already contain it. |
void |
setJndiName(java.lang.String jndiName)
Set the JNDI name. |
void |
setJndiTemplate(JndiTemplate template)
Set the JNDI template to use for the JNDI lookup. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.lang.String CONTAINER_PREFIX
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
public AbstractJndiLocator()
Obviously, this class is typically used via a BeanFactory.
public AbstractJndiLocator(java.lang.String jndiName)
throws javax.naming.NamingException,
java.lang.IllegalArgumentException
As this is a shortcut, it calls afterPropertiesSet to perform the JNDI lookup immediately.
jndiName - JNDI name.| Method Detail |
public final void setJndiTemplate(JndiTemplate template)
public final JndiTemplate getJndiTemplate()
public final void setJndiName(java.lang.String jndiName)
jndiName - JNDI name of bean to look upsetInContainer(boolean)public final java.lang.String getJndiName()
public final void setInContainer(boolean inContainer)
public final boolean isInContainer()
public final void afterPropertiesSet()
throws javax.naming.NamingException,
java.lang.IllegalArgumentException
InitializingBeanafterPropertiesSet in interface InitializingBeancom.interface21.beans.factory.InitializingBeanjava.lang.Exception - in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.protected abstract void located(java.lang.Object o)
o - object successfully retrieved from JNDI
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||