|
|||||||||||
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 performs all JNDI context handling.
JndiCallback
,
execute(org.springframework.jndi.JndiCallback)
Field Summary | |
protected Log |
logger
|
Constructor Summary | |
JndiTemplate()
Create a new JndiTemplate instance. |
|
JndiTemplate(Properties environment)
Create a new JndiTemplate instance, using the given environment. |
Method Summary | |
void |
bind(String name,
Object object)
Bind the given object to the current JNDI context, using the given name. |
protected Context |
createInitialContext()
Create a new JNDI initial context. |
Object |
execute(JndiCallback contextCallback)
Execute the given JNDI context callback implementation. |
Properties |
getEnvironment()
Return the environment for the JNDI InitialContext. |
Object |
lookup(String name)
Look up the object with the given name in the current JNDI context. |
void |
rebind(String name,
Object object)
Rebind the given object to the current JNDI context, using the given name. |
void |
setEnvironment(Properties environment)
Set the environment for the JNDI InitialContext. |
void |
unbind(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 Log logger
Constructor Detail |
public JndiTemplate()
public JndiTemplate(Properties environment)
Method Detail |
public void setEnvironment(Properties environment)
public Properties getEnvironment()
public Object execute(JndiCallback contextCallback) throws NamingException
contextCallback
- JndiCallback implementation
NamingException
- thrown by the callback implementationcreateInitialContext()
protected Context createInitialContext() throws NamingException
NamingException
- in case of initialization errorspublic Object lookup(String name) throws NamingException
name
- the JNDI name of the object
NamingException
- if there is no object with the given
name bound to JNDIpublic void bind(String name, Object object) throws NamingException
name
- the JNDI name of the objectobject
- the object to bind
NamingException
- thrown by JNDI, mostly name already boundpublic void rebind(String name, Object object) throws NamingException
name
- the JNDI name of the objectobject
- the object to rebind
NamingException
- thrown by JNDIpublic void unbind(String name) throws NamingException
name
- the JNDI name of the object
NamingException
- thrown by JNDI, mostly name not found
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |