|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.mock.jndi.SimpleNamingContext
public class SimpleNamingContext
Simple implementation of a JNDI naming context. Only supports binding plain Objects to String names. Mainly for test environments, but also usable for standalone applications.
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()
Nested Class Summary | |
---|---|
private static class |
SimpleNamingContext.AbstractNamingEnumeration<T>
|
private static class |
SimpleNamingContext.BindingEnumeration
|
private static class |
SimpleNamingContext.NameClassPairEnumeration
|
Field Summary | |
---|---|
private java.util.Hashtable<java.lang.String,java.lang.Object> |
boundObjects
|
private java.util.Hashtable<java.lang.String,java.lang.Object> |
environment
|
private Log |
logger
|
private java.lang.String |
root
|
Fields inherited from interface javax.naming.Context |
---|
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Log logger
private final java.lang.String root
private final java.util.Hashtable<java.lang.String,java.lang.Object> boundObjects
private final java.util.Hashtable<java.lang.String,java.lang.Object> environment
Constructor Detail |
---|
public SimpleNamingContext()
public SimpleNamingContext(java.lang.String root)
public 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)
Method Detail |
---|
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |