Package org.apache.naming
Class NamingContext
java.lang.Object
org.apache.naming.NamingContext
- All Implemented Interfaces:
Context
Catalina JNDI Context implementation.
- Author:
- Remy Maucherat
-
Field Summary
Modifier and TypeFieldDescriptionprotected final HashMap<String,
NamingEntry> Bindings in this Context.Environment.protected final String
Name of the associated Catalina Context.protected static final NameParser
Name parser for this context.protected static final StringManager
The string manager for this package.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
ConstructorDescriptionNamingContext
(Hashtable<String, Object> env, String name) Builds a naming context.NamingContext
(Hashtable<String, Object> env, String name, HashMap<String, NamingEntry> bindings) Builds a naming context. -
Method Summary
Modifier and TypeMethodDescriptionaddToEnvironment
(String propName, Object propVal) void
void
protected void
Binds a name to an object.protected boolean
Throws a naming exception is Context is not writable.void
close()
composeName
(String name, String prefix) composeName
(Name name, Name prefix) createSubcontext
(String name) createSubcontext
(Name name) void
destroySubcontext
(String name) void
destroySubcontext
(Name name) Hashtable<?,
?> boolean
getNameParser
(String name) getNameParser
(Name name) protected boolean
listBindings
(String name) listBindings
(Name name) protected Object
Retrieves the named object.lookupLink
(String name) lookupLink
(Name name) void
void
removeFromEnvironment
(String propName) void
void
void
setExceptionOnFailedWrite
(boolean exceptionOnFailedWrite) void
void
-
Field Details
-
nameParser
Name parser for this context. -
env
Environment. -
sm
The string manager for this package. -
bindings
Bindings in this Context. -
name
Name of the associated Catalina Context.
-
-
Constructor Details
-
NamingContext
Builds a naming context.- Parameters:
env
- The environment to use to construct the naming contextname
- The name of the associated Catalina Context
-
NamingContext
public NamingContext(Hashtable<String, Object> env, String name, HashMap<String, NamingEntry> bindings) Builds a naming context.- Parameters:
env
- The environment to use to construct the naming contextname
- The name of the associated Catalina Contextbindings
- The initial bindings for the naming context
-
-
Method Details
-
getExceptionOnFailedWrite
public boolean getExceptionOnFailedWrite() -
setExceptionOnFailedWrite
public void setExceptionOnFailedWrite(boolean exceptionOnFailedWrite) -
lookup
- Specified by:
lookup
in interfaceContext
- Throws:
NamingException
-
lookup
- Specified by:
lookup
in interfaceContext
- Throws:
NamingException
-
bind
- Specified by:
bind
in interfaceContext
- Throws:
NamingException
-
bind
- Specified by:
bind
in interfaceContext
- Throws:
NamingException
-
rebind
- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
-
rebind
- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
-
unbind
- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
-
unbind
- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
-
rename
- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
rename
- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
list
- Specified by:
list
in interfaceContext
- Throws:
NamingException
-
list
- Specified by:
list
in interfaceContext
- Throws:
NamingException
-
listBindings
- Specified by:
listBindings
in interfaceContext
- Throws:
NamingException
-
listBindings
- Specified by:
listBindings
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParser
in interfaceContext
- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParser
in interfaceContext
- Throws:
NamingException
-
composeName
- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
composeName
- Specified by:
composeName
in interfaceContext
-
addToEnvironment
- Specified by:
addToEnvironment
in interfaceContext
-
removeFromEnvironment
- Specified by:
removeFromEnvironment
in interfaceContext
-
getEnvironment
- Specified by:
getEnvironment
in interfaceContext
-
close
- Specified by:
close
in interfaceContext
- Throws:
NamingException
-
getNameInNamespace
- Specified by:
getNameInNamespace
in interfaceContext
- Throws:
NamingException
-
lookup
Retrieves the named object.- Parameters:
name
- the name of the object to look upresolveLinks
- If true, the links will be resolved- Returns:
- the object bound to name
- Throws:
NamingException
- if a naming exception is encountered
-
bind
Binds a name to an object. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist.- Parameters:
name
- the name to bind; may not be emptyobj
- the object to bind; possibly nullrebind
- if true, then perform a rebind (ie, overwrite)- Throws:
NameAlreadyBoundException
- if name is already boundInvalidAttributesException
- if object did not supply all mandatory attributesNamingException
- if a naming exception is encountered
-
isWritable
protected boolean isWritable()- Returns:
true
if writing is allowed on this context.
-
checkWritable
Throws a naming exception is Context is not writable.- Returns:
true
if the Context is writable- Throws:
NamingException
- if the Context is not writable andexceptionOnFailedWrite
istrue
-