|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jndi.JndiTemplate
Helper class that simplifies JNDI operations. It provides methods to lookup and bind objects, and allows implementations of the JndiCallback interface to perform any operation they like with a JNDI naming context provided.
This is the central class in this package. It is analogous to the JdbcTemplate class. This class performs all JNDI context handling.
JndiCallback
,
JdbcTemplate
Field Summary | |
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
JndiTemplate()
Create a new JndiTemplate instance. |
|
JndiTemplate(java.util.Properties environment)
Create a new JndiTemplate instance, using the given environment. |
Method Summary | |
void |
bind(java.lang.String name,
java.lang.Object object)
Bind the given object to the current JNDI context, using the given name. |
protected javax.naming.Context |
createInitialContext()
Create a new JNDI initial context. |
java.lang.Object |
execute(JndiCallback contextCallback)
Execute the given JNDI context callback implementation. |
java.util.Properties |
getEnvironment()
Return the environment for the JNDI InitialContext. |
java.lang.Object |
lookup(java.lang.String name)
Look up the object with the given name in the current JNDI context. |
void |
setEnvironment(java.util.Properties environment)
Set the environment for the JNDI InitialContext. |
void |
unbind(java.lang.String name)
Remove the binding for the given name from the current JNDI context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public JndiTemplate()
public JndiTemplate(java.util.Properties environment)
Method Detail |
public void setEnvironment(java.util.Properties environment)
public java.util.Properties getEnvironment()
public java.lang.Object execute(JndiCallback contextCallback) throws javax.naming.NamingException
contextCallback
- JndiCallback implementation
javax.naming.NamingException
- thrown by the callback implementationcreateInitialContext()
protected javax.naming.Context createInitialContext() throws javax.naming.NamingException
javax.naming.NamingException
- in case of initialization errorspublic java.lang.Object lookup(java.lang.String name) throws javax.naming.NamingException
name
- the JNDI name of the object
javax.naming.NamingException
- if there is no object with the given
name bound to JNDIpublic void bind(java.lang.String name, java.lang.Object object) throws javax.naming.NamingException
name
- the JNDI name of the objectobject
- the object to bind
javax.naming.NamingException
- thrown by JNDI, mostly name already boundpublic void unbind(java.lang.String name) throws javax.naming.NamingException
name
- the JNDI name of the object
javax.naming.NamingException
- thrown by JNDI, mostly name not found
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |