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.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new JndiTemplate instance.
| |||||||||||
Create a new JndiTemplate instance, using the given environment.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Bind the given object to the current JNDI context, using the given name.
| |||||||||||
Execute the given JNDI context callback implementation.
| |||||||||||
Obtain a JNDI context corresponding to this template's configuration.
| |||||||||||
Return the environment for the JNDI InitialContext, if any.
| |||||||||||
Look up the object with the given name in the current JNDI context.
| |||||||||||
Look up the object with the given name in the current JNDI context.
| |||||||||||
Rebind the given object to the current JNDI context, using the given name.
| |||||||||||
Release a JNDI context as obtained from
getContext() . | |||||||||||
Set the environment for the JNDI InitialContext.
| |||||||||||
Remove the binding for the given name from the current JNDI context.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new JNDI initial context.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Create a new JndiTemplate instance.
Create a new JndiTemplate instance, using the given environment.
Bind the given object to the current JNDI context, using the given name.
name | the JNDI name of the object |
---|---|
object | the object to bind |
NamingException | thrown by JNDI, mostly name already bound |
---|
Execute the given JNDI context callback implementation.
contextCallback | JndiCallback implementation |
---|
null
NamingException | thrown by the callback implementation |
---|
Obtain a JNDI context corresponding to this template's configuration.
Called by execute(JndiCallback
; may also be called directly.
The default implementation delegates to createInitialContext()
.
null
)NamingException | if context retrieval failed |
---|
Look up the object with the given name in the current JNDI context.
name | the JNDI name of the object |
---|---|
requiredType | type the JNDI object must match. Can be an interface or
superclass of the actual class, or null for any match. For example,
if the value is Object.class , this method will succeed whatever
the class of the returned instance. |
null
; if a not so well-behaved
JNDI implementations returns null, a NamingException gets thrown)NamingException | if there is no object with the given name bound to JNDI |
---|
Look up the object with the given name in the current JNDI context.
name | the JNDI name of the object |
---|
null
; if a not so well-behaved
JNDI implementations returns null, a NamingException gets thrown)NamingException | if there is no object with the given name bound to JNDI |
---|
Rebind the given object to the current JNDI context, using the given name. Overwrites any existing binding.
name | the JNDI name of the object |
---|---|
object | the object to rebind |
NamingException | thrown by JNDI |
---|
Release a JNDI context as obtained from getContext()
.
ctx | the JNDI context to release (may be null ) |
---|
Set the environment for the JNDI InitialContext.
Remove the binding for the given name from the current JNDI context.
name | the JNDI name of the object |
---|
NamingException | thrown by JNDI, mostly name not found |
---|
Create a new JNDI initial context. Invoked by getContext()
.
The default implementation use this template's environment settings. Can be subclassed for custom contexts, e.g. for testing.
NamingException | in case of initialization errors |
---|