org.springframework.jndi.support
Class SimpleNamingContext


public class SimpleNamingContext
implements Context

Simple implementation of a JNDI naming context. Only supports binding plain Objects to String names. Mainly targetted at test environments, but also usable for standalone applications.

This class is not intended for direct usage by applications, although it can be used e.g. to override's JndiTemplate's createInitialContext method in unit tests. Use SimpleNamingContextBuilder to set up a JVM-level JNDI environment.

Author:
Rod Johnson, Juergen Hoeller
See Also: SimpleNamingContextBuilder, org.springframework.jndi.JndiTemplate.createInitialContext()

Constructor Summary
SimpleNamingContext()
          Create a new naming context.
SimpleNamingContext(String root)
          Create a new naming context with the given naming root.
SimpleNamingContext(String root, Hashtable boundObjects, Hashtable environment)
          Create a new naming context with the given naming root, the given name/object map, and the JNDI environment entries.

Method Summary
 ObjectaddToEnvironment(String propName, Object propVal)
           
 voidbind(String name, Object obj)
          Bind the given object to the given name.
 voidbind(Name arg0, Object arg1)
           
 voidclose()
           
 NamecomposeName(Name arg0, Name arg1)
           
 StringcomposeName(String arg0, String arg1)
           
 ContextcreateSubcontext(String name)
           
 ContextcreateSubcontext(Name arg0)
           
 voiddestroySubcontext(String name)
           
 voiddestroySubcontext(Name arg0)
           
 HashtablegetEnvironment()
           
 StringgetNameInNamespace()
           
 NameParsergetNameParser(Name arg0)
           
 NameParsergetNameParser(String arg0)
           
 NamingEnumerationlist(String root)
           
 NamingEnumerationlist(Name arg0)
           
 NamingEnumerationlistBindings(String root)
           
 NamingEnumerationlistBindings(Name arg0)
           
 Objectlookup(String pname)
          Look up the object with the given name.
 Objectlookup(Name arg0)
           
 ObjectlookupLink(String name)
           
 ObjectlookupLink(Name arg0)
           
 voidrebind(String name, Object obj)
           
 voidrebind(Name arg0, Object arg1)
           
 ObjectremoveFromEnvironment(String propName)
           
 voidrename(String oldName, String newName)
           
 voidrename(Name arg0, Name arg1)
           
 voidunbind(String name)
           
 voidunbind(Name arg0)
           

Constructor Detail

SimpleNamingContext

public SimpleNamingContext()
Create a new naming context.

SimpleNamingContext

public SimpleNamingContext(String root)
Create a new naming context with the given naming root.

SimpleNamingContext

public SimpleNamingContext(String root, Hashtable boundObjects, Hashtable environment)
Create a new naming context with the given naming root, the given name/object map, and the JNDI environment entries.
Method Detail

addToEnvironment

public Object addToEnvironment(String propName, Object propVal)

bind

public void bind(String name, Object obj)
Bind the given object to the given name. Note: Not intended for direct use by applications if setting up a JVM-level JNDI environment. Use SimpleNamingContextBuilder to set up JNDI bindings then.
See Also:
SimpleNamingContextBuilder.bind(java.lang.String,java.lang.Object)

bind

public void bind(Name arg0, Object arg1)

close

public void close()

composeName

public Name composeName(Name arg0, Name arg1)

composeName

public String composeName(String arg0, String arg1)

createSubcontext

public Context createSubcontext(String name)

createSubcontext

public Context createSubcontext(Name arg0)

destroySubcontext

public void destroySubcontext(String name)

destroySubcontext

public void destroySubcontext(Name arg0)

getEnvironment

public Hashtable getEnvironment()

getNameInNamespace

public String getNameInNamespace()

getNameParser

public NameParser getNameParser(Name arg0)

getNameParser

public NameParser getNameParser(String arg0)

list

public NamingEnumeration list(String root)
throws javax.naming.NamingException

list

public NamingEnumeration list(Name arg0)

listBindings

public NamingEnumeration listBindings(String root)
throws javax.naming.NamingException

listBindings

public NamingEnumeration listBindings(Name arg0)

lookup

public Object lookup(String pname)
throws javax.naming.NameNotFoundException
Look up the object with the given name. Note: Not intended for direct use by applications. Will be used by any standard InitialContext JNDI lookups.
Throws:
NameNotFoundException - if the object could not be found

lookup

public Object lookup(Name arg0)

lookupLink

public Object lookupLink(String name)
throws javax.naming.NameNotFoundException

lookupLink

public Object lookupLink(Name arg0)

rebind

public void rebind(String name, Object obj)

rebind

public void rebind(Name arg0, Object arg1)

removeFromEnvironment

public Object removeFromEnvironment(String propName)

rename

public void rename(String oldName, String newName)
throws javax.naming.NameNotFoundException

rename

public void rename(Name arg0, Name arg1)

unbind

public void unbind(String name)

unbind

public void unbind(Name arg0)

Association Links

to Class java.lang.String

to Class java.util.Hashtable

to Class java.util.Hashtable