public class SimpleNamingContext
extends java.lang.Object
implements javax.naming.Context
This class is not intended for direct usage by applications, although it
can be used for example to override JndiTemplate's createInitialContext
method in unit tests. Typically, SimpleNamingContextBuilder will be used to
set up a JVM-level JNDI environment.
SimpleNamingContextBuilder
,
JndiTemplate.createInitialContext()
Constructor and Description |
---|
SimpleNamingContext()
Create a new naming context.
|
SimpleNamingContext(java.lang.String root)
Create a new naming context with the given naming root.
|
SimpleNamingContext(java.lang.String root,
java.util.Hashtable<java.lang.String,java.lang.Object> boundObjects,
java.util.Hashtable<java.lang.String,java.lang.Object> env)
Create a new naming context with the given naming root,
the given name/object map, and the JNDI environment entries.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
addToEnvironment(java.lang.String propName,
java.lang.Object propVal) |
void |
bind(javax.naming.Name name,
java.lang.Object obj) |
void |
bind(java.lang.String name,
java.lang.Object obj)
Bind the given object to the given name.
|
void |
close() |
javax.naming.Name |
composeName(javax.naming.Name name,
javax.naming.Name prefix) |
java.lang.String |
composeName(java.lang.String name,
java.lang.String prefix) |
javax.naming.Context |
createSubcontext(javax.naming.Name name) |
javax.naming.Context |
createSubcontext(java.lang.String name) |
void |
destroySubcontext(javax.naming.Name name) |
void |
destroySubcontext(java.lang.String name) |
java.util.Hashtable<java.lang.String,java.lang.Object> |
getEnvironment() |
java.lang.String |
getNameInNamespace() |
javax.naming.NameParser |
getNameParser(javax.naming.Name name) |
javax.naming.NameParser |
getNameParser(java.lang.String name) |
javax.naming.NamingEnumeration<javax.naming.NameClassPair> |
list(javax.naming.Name name) |
javax.naming.NamingEnumeration<javax.naming.NameClassPair> |
list(java.lang.String root) |
javax.naming.NamingEnumeration<javax.naming.Binding> |
listBindings(javax.naming.Name name) |
javax.naming.NamingEnumeration<javax.naming.Binding> |
listBindings(java.lang.String root) |
java.lang.Object |
lookup(javax.naming.Name name) |
java.lang.Object |
lookup(java.lang.String lookupName)
Look up the object with the given name.
|
java.lang.Object |
lookupLink(javax.naming.Name name) |
java.lang.Object |
lookupLink(java.lang.String name) |
void |
rebind(javax.naming.Name name,
java.lang.Object obj) |
void |
rebind(java.lang.String name,
java.lang.Object obj) |
java.lang.Object |
removeFromEnvironment(java.lang.String propName) |
void |
rename(javax.naming.Name oldName,
javax.naming.Name newName) |
void |
rename(java.lang.String oldName,
java.lang.String newName) |
void |
unbind(javax.naming.Name name) |
void |
unbind(java.lang.String name) |
public SimpleNamingContext()
public SimpleNamingContext(java.lang.String root)
public SimpleNamingContext(java.lang.String root, java.util.Hashtable<java.lang.String,java.lang.Object> boundObjects, @Nullable java.util.Hashtable<java.lang.String,java.lang.Object> env)
public javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(java.lang.String root) throws javax.naming.NamingException
list
in interface javax.naming.Context
javax.naming.NamingException
public javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(java.lang.String root) throws javax.naming.NamingException
listBindings
in interface javax.naming.Context
javax.naming.NamingException
public java.lang.Object lookup(java.lang.String lookupName) throws javax.naming.NameNotFoundException
Note: Not intended for direct use by applications. Will be used by any standard InitialContext JNDI lookups.
lookup
in interface javax.naming.Context
javax.naming.NameNotFoundException
- if the object could not be foundpublic java.lang.Object lookupLink(java.lang.String name) throws javax.naming.NameNotFoundException
lookupLink
in interface javax.naming.Context
javax.naming.NameNotFoundException
public void bind(java.lang.String name, java.lang.Object obj)
bind
in interface javax.naming.Context
SimpleNamingContextBuilder.bind(java.lang.String, java.lang.Object)
public void unbind(java.lang.String name)
unbind
in interface javax.naming.Context
public void rebind(java.lang.String name, java.lang.Object obj)
rebind
in interface javax.naming.Context
public void rename(java.lang.String oldName, java.lang.String newName) throws javax.naming.NameNotFoundException
rename
in interface javax.naming.Context
javax.naming.NameNotFoundException
public javax.naming.Context createSubcontext(java.lang.String name)
createSubcontext
in interface javax.naming.Context
public void destroySubcontext(java.lang.String name)
destroySubcontext
in interface javax.naming.Context
public java.lang.String composeName(java.lang.String name, java.lang.String prefix)
composeName
in interface javax.naming.Context
public java.util.Hashtable<java.lang.String,java.lang.Object> getEnvironment()
getEnvironment
in interface javax.naming.Context
public java.lang.Object addToEnvironment(java.lang.String propName, java.lang.Object propVal)
addToEnvironment
in interface javax.naming.Context
public java.lang.Object removeFromEnvironment(java.lang.String propName)
removeFromEnvironment
in interface javax.naming.Context
public void close()
close
in interface javax.naming.Context
public javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(javax.naming.Name name) throws javax.naming.NamingException
list
in interface javax.naming.Context
javax.naming.NamingException
public javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(javax.naming.Name name) throws javax.naming.NamingException
listBindings
in interface javax.naming.Context
javax.naming.NamingException
public java.lang.Object lookup(javax.naming.Name name) throws javax.naming.NamingException
lookup
in interface javax.naming.Context
javax.naming.NamingException
public java.lang.Object lookupLink(javax.naming.Name name) throws javax.naming.NamingException
lookupLink
in interface javax.naming.Context
javax.naming.NamingException
public void bind(javax.naming.Name name, java.lang.Object obj) throws javax.naming.NamingException
bind
in interface javax.naming.Context
javax.naming.NamingException
public void unbind(javax.naming.Name name) throws javax.naming.NamingException
unbind
in interface javax.naming.Context
javax.naming.NamingException
public void rebind(javax.naming.Name name, java.lang.Object obj) throws javax.naming.NamingException
rebind
in interface javax.naming.Context
javax.naming.NamingException
public void rename(javax.naming.Name oldName, javax.naming.Name newName) throws javax.naming.NamingException
rename
in interface javax.naming.Context
javax.naming.NamingException
public javax.naming.Context createSubcontext(javax.naming.Name name) throws javax.naming.NamingException
createSubcontext
in interface javax.naming.Context
javax.naming.NamingException
public void destroySubcontext(javax.naming.Name name) throws javax.naming.NamingException
destroySubcontext
in interface javax.naming.Context
javax.naming.NamingException
public java.lang.String getNameInNamespace() throws javax.naming.NamingException
getNameInNamespace
in interface javax.naming.Context
javax.naming.NamingException
public javax.naming.NameParser getNameParser(javax.naming.Name name) throws javax.naming.NamingException
getNameParser
in interface javax.naming.Context
javax.naming.NamingException
public javax.naming.NameParser getNameParser(java.lang.String name) throws javax.naming.NamingException
getNameParser
in interface javax.naming.Context
javax.naming.NamingException
public javax.naming.Name composeName(javax.naming.Name name, javax.naming.Name prefix) throws javax.naming.NamingException
composeName
in interface javax.naming.Context
javax.naming.NamingException