JndiCallback interface
to perform any operation they like with a JNDI naming context provided.
JndiCallback, execute
| Modifier and Type | Field and Description |
|---|---|
| private Properties | |
| protected final Log |
| Access | Constructor and Description |
|---|---|
| public | |
| public | JndiTemplate(Properties environment)
Create a new JndiTemplate instance, using the given environment. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected Context | |
| public <T> T | Returns: a result object returned by the callback, ornullthe JndiCallback implementation to use contextCallback)Execute the given JNDI context callback implementation. |
| public Context | Returns: the JNDI context (nevernull)Obtain a JNDI context corresponding to this template's configuration. |
| public Properties | |
| public Object | |
| public <T> T | Returns: object found (cannot benull; if a not so well-behaved
JNDI implementations returns null, a NamingException gets thrown)the JNDI name of the object name, Class<T> type the JNDI object must match. Can be an interface or
superclass of the actual class, or requiredType)null for any match. For example,
if the value is Object.class, this method will succeed whatever
the class of the returned instance.Look up the object with the given name in the current JNDI context. |
| public void | |
| public void | releaseContext(Context
the JNDI context to release (may be ctx)null)Release a JNDI context as obtained from |
| public void | |
| public void |
| environment | back to summary |
|---|---|
| private Properties environment
| |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| JndiTemplate | back to summary |
|---|---|
| public JndiTemplate() Create a new JndiTemplate instance. | |
| JndiTemplate | back to summary |
|---|---|
| public JndiTemplate(Properties environment) Create a new JndiTemplate instance, using the given environment. | |
| bind | back to summary |
|---|---|
| public void bind(final String name, final Object object) throws NamingException Bind the given object to the current JNDI context, using the given name.
| |
| createInitialContext | back to summary |
|---|---|
| protected Context createInitialContext() throws NamingException Create a new JNDI initial context. Invoked by The default implementation use this template's environment settings. Can be subclassed for custom contexts, e.g. for testing.
| |
| execute | back to summary |
|---|---|
| public <T> T execute(JndiCallback<T> contextCallback) throws NamingException Execute the given JNDI context callback implementation.
| |
| getContext | back to summary |
|---|---|
| public Context getContext() throws NamingException Obtain a JNDI context corresponding to this template's configuration.
Called by The default implementation delegates to
| |
| getEnvironment | back to summary |
|---|---|
| public Properties getEnvironment() Return the environment for the JNDI InitialContext, if any.
| |
| lookup | back to summary |
|---|---|
| public Object lookup(final String name) throws NamingException Look up the object with the given name in the current JNDI context.
| |
| lookup | back to summary |
|---|---|
| public <T> T lookup(String name, Class<T> requiredType) throws NamingException Look up the object with the given name in the current JNDI context.
| |
| rebind | back to summary |
|---|---|
| public void rebind(final String name, final Object object) throws NamingException Rebind the given object to the current JNDI context, using the given name. Overwrites any existing binding.
| |
| releaseContext | back to summary |
|---|---|
| public void releaseContext(Context ctx) Release a JNDI context as obtained from
| |
| setEnvironment | back to summary |
|---|---|
| public void setEnvironment(Properties environment) Set the environment for the JNDI InitialContext. | |
| unbind | back to summary |
|---|---|
| public void unbind(final String name) throws NamingException Remove the binding for the given name from the current JNDI context.
| |