Package cronapi.osjava.sj.jndi
Class AbstractContext
- java.lang.Object
-
- cronapi.osjava.sj.jndi.AbstractContext
-
- Direct Known Subclasses:
MemoryContext
public abstract class AbstractContext extends Object implements Cloneable, Context
The heart of the system, the abstract implementation of context for simple-jndi. There are no abstract methods in this class, but it is not meant to be instantiated, but extended instead.- Since:
- Simple-JNDI 0.11
- Version:
- $Rev: 2684 $ $Date: 2008-05-24 22:19:06 -0700 (Sat, 24 May 2008) $
- Author:
- Robert M. Zigweid
-
-
Field Summary
-
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
Constructors Modifier Constructor Description protectedAbstractContext()Creates a AbstractContext.protectedAbstractContext(boolean systemOverride)Creates a AbstractContext.protectedAbstractContext(boolean systemOverride, NameParser parser)Creates a AbstractContext.protectedAbstractContext(AbstractContext that)Create a new context based upon the environment of the passed context.protectedAbstractContext(Hashtable env)Creates a AbstractContext.protectedAbstractContext(Hashtable env, boolean systemOverride)Creates a AbstractContext.protectedAbstractContext(Hashtable env, boolean systemOverride, NameParser parser)Creates a AbstractContext.protectedAbstractContext(Hashtable env, NameParser parser)Creates a AbstractContext.protectedAbstractContext(NameParser parser)Creates a AbstractContext.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ObjectaddToEnvironment(String name, Object object)voidbind(String name, Object object)voidbind(Name name, Object object)voidclose()StringcomposeName(String name, String prefix)NamecomposeName(Name name, Name prefix)ContextcreateSubcontext(String name)abstract ContextcreateSubcontext(Name name)voiddestroySubcontext(String name)voiddestroySubcontext(Name name)HashtablegetEnvironment()StringgetNameInNamespace()NameParsergetNameParser(String name)NameParsergetNameParser(Name name)protected HashtablegetSubContexts()Convenience method returning the subcontexts that this context parents.booleanisEmpty()Determine whether or not the context is empty.static booleanisSharedAndLoaded()Whether this context is running in shared mode AND has already been loaded with data.NamingEnumerationlist(String name)NamingEnumerationlist(Name name)NamingEnumerationlistBindings(String name)NamingEnumerationlistBindings(Name name)Objectlookup(String name)Objectlookup(Name name)Return the named object.ObjectlookupLink(String name)ObjectlookupLink(Name name)voidrebind(String name, Object object)voidrebind(Name name, Object object)ObjectremoveFromEnvironment(String name)voidrename(String oldName, String newName)voidrename(Name oldName, Name newName)protected voidsetNameInNamespace(String name)Set the name of the Context.voidsetNameInNamespace(Name name)Set the name of the Context.voidunbind(String name)voidunbind(Name name)
-
-
-
Constructor Detail
-
AbstractContext
protected AbstractContext()
Creates a AbstractContext.
-
AbstractContext
protected AbstractContext(Hashtable env)
Creates a AbstractContext.- Parameters:
env- a Hashtable containing the Context's environemnt.
-
AbstractContext
protected AbstractContext(Hashtable env, boolean systemOverride)
Creates a AbstractContext.- Parameters:
env- a Hashtable containing the Context's environment.systemOverride- allow System Parameters to override the environment that is passed in.
-
AbstractContext
protected AbstractContext(Hashtable env, NameParser parser)
Creates a AbstractContext.- Parameters:
env- a Hashtable containing the Context's environment.parser- the NameParser being used by the Context.
-
AbstractContext
protected AbstractContext(boolean systemOverride)
Creates a AbstractContext.- Parameters:
systemOverride- allow System Parameters to override the environment that is passed in.
-
AbstractContext
protected AbstractContext(boolean systemOverride, NameParser parser)Creates a AbstractContext.- Parameters:
systemOverride- allow System Parameters to override the environment that is passed in.parser- the NameParser being used by the Context.
-
AbstractContext
protected AbstractContext(NameParser parser)
Creates a AbstractContext.- Parameters:
parser- the NameParser being used by the Context.
-
AbstractContext
protected AbstractContext(Hashtable env, boolean systemOverride, NameParser parser)
Creates a AbstractContext.- Parameters:
env- a Hashtable containing the Context's environment.systemOverride- allow System Parameters to override the environment that is passed in.parser- the NameParser being used by the Context.
-
AbstractContext
protected AbstractContext(AbstractContext that)
Create a new context based upon the environment of the passed context.- Parameters:
that-
-
-
Method Detail
-
lookup
public Object lookup(Name name) throws NamingException
Return the named object. This implementation looks for things in the following order:
- The empty element to duplicate the context.
- A named object in the environment.
- A named object in the Context's store
- A named sub-Context of this Context
- Specified by:
lookupin interfaceContext- Throws:
NamingException- See Also:
Context.lookup(Name)
-
lookup
public Object lookup(String name) throws NamingException
- Specified by:
lookupin interfaceContext- Throws:
NamingException- See Also:
Context.lookup(String)
-
bind
public void bind(Name name, Object object) throws NamingException
- Specified by:
bindin interfaceContext- Throws:
NamingException- See Also:
Context.bind(Name, Object)
-
bind
public void bind(String name, Object object) throws NamingException
- Specified by:
bindin interfaceContext- Throws:
NamingException- See Also:
Context.bind(String, Object)
-
rebind
public void rebind(Name name, Object object) throws NamingException
- Specified by:
rebindin interfaceContext- Throws:
NamingException- See Also:
Context.rebind(Name, Object)
-
rebind
public void rebind(String name, Object object) throws NamingException
- Specified by:
rebindin interfaceContext- Throws:
NamingException- See Also:
Context.rebind(String, Object)
-
unbind
public void unbind(Name name) throws NamingException
- Specified by:
unbindin interfaceContext- Throws:
NamingException- See Also:
Context.unbind(Name)
-
unbind
public void unbind(String name) throws NamingException
- Specified by:
unbindin interfaceContext- Throws:
NamingException- See Also:
Context.unbind(String)
-
rename
public void rename(Name oldName, Name newName) throws NamingException
- Specified by:
renamein interfaceContext- Throws:
NamingException- See Also:
Context.rename(Name, Name)
-
rename
public void rename(String oldName, String newName) throws NamingException
- Specified by:
renamein interfaceContext- Throws:
NamingException- See Also:
Context.rename(String, String)
-
list
public NamingEnumeration list(Name name) throws NamingException
- Specified by:
listin interfaceContext- Throws:
NamingException- See Also:
Context.list(Name)
-
list
public NamingEnumeration list(String name) throws NamingException
- Specified by:
listin interfaceContext- Throws:
NamingException- See Also:
Context.list(String)
-
listBindings
public NamingEnumeration listBindings(Name name) throws NamingException
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException- See Also:
Context.listBindings(Name)
-
listBindings
public NamingEnumeration listBindings(String name) throws NamingException
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException- See Also:
Context.listBindings(String)
-
destroySubcontext
public void destroySubcontext(Name name) throws NamingException
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException- See Also:
Context.destroySubcontext(Name)
-
destroySubcontext
public void destroySubcontext(String name) throws NamingException
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException- See Also:
Context.destroySubcontext(String)
-
createSubcontext
public abstract Context createSubcontext(Name name) throws NamingException
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException- See Also:
Context.createSubcontext(Name)
-
createSubcontext
public Context createSubcontext(String name) throws NamingException
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException- See Also:
Context.createSubcontext(String)
-
lookupLink
public Object lookupLink(Name name) throws NamingException
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException- See Also:
Context.lookupLink(Name)
-
lookupLink
public Object lookupLink(String name) throws NamingException
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException- See Also:
Context.lookupLink(String)
-
getNameParser
public NameParser getNameParser(Name name) throws NamingException
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException- See Also:
Context.getNameParser(Name)
-
getNameParser
public NameParser getNameParser(String name) throws NamingException
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException- See Also:
Context.getNameParser(String)
-
composeName
public Name composeName(Name name, Name prefix) throws NamingException
- Specified by:
composeNamein interfaceContext- Throws:
NamingException- See Also:
Context.composeName(Name, Name)
-
composeName
public String composeName(String name, String prefix) throws NamingException
- Specified by:
composeNamein interfaceContext- Throws:
NamingException- See Also:
Context.composeName(String, String)
-
addToEnvironment
public Object addToEnvironment(String name, Object object) throws NamingException
- Specified by:
addToEnvironmentin interfaceContext- Throws:
NamingException- See Also:
Context.addToEnvironment(String, Object)
-
removeFromEnvironment
public Object removeFromEnvironment(String name) throws NamingException
- Specified by:
removeFromEnvironmentin interfaceContext- Throws:
NamingException- See Also:
Context.removeFromEnvironment(String)
-
getEnvironment
public Hashtable getEnvironment() throws NamingException
- Specified by:
getEnvironmentin interfaceContext- Throws:
NamingException- See Also:
Context.getEnvironment()
-
close
public void close() throws NamingException- Specified by:
closein interfaceContext- Throws:
NamingException- See Also:
Context.close()
-
getNameInNamespace
public String getNameInNamespace() throws NamingException
- Specified by:
getNameInNamespacein interfaceContext- Throws:
NamingException- See Also:
Context.getNameInNamespace()
-
isEmpty
public boolean isEmpty()
Determine whether or not the context is empty. Objects bound directly to the context or subcontexts are all that is considered. The environment of the context is not considered.- Returns:
- true of the context is empty, else false.
-
setNameInNamespace
public void setNameInNamespace(Name name) throws NamingException
Set the name of the Context. This is only used from createSubcontext. It might get replaced by adding more constructors, but there is really no reason to expose it publicly anyway.- Parameters:
name- the Name of the context.- Throws:
NamingException- if the subContext already has a name.
-
setNameInNamespace
protected void setNameInNamespace(String name) throws NamingException
Set the name of the Context. This is only used from createSubcontext. It might get replaced by adding more constructors, but there is really no reason to expose it publicly anyway.- Parameters:
name- a String representation of the Name of the context.- Throws:
NamingException- if the subContext already has a name.
-
getSubContexts
protected Hashtable getSubContexts()
Convenience method returning the subcontexts that this context parents.- Returns:
- a Hashtable of context objects that are parented by this context.
-
isSharedAndLoaded
public static boolean isSharedAndLoaded()
Whether this context is running in shared mode AND has already been loaded with data.
-
-