Package org.apache.activemq.jndi
Class ReadOnlyContext
java.lang.Object
org.apache.activemq.jndi.ReadOnlyContext
- All Implemented Interfaces:
Serializable,Context
- Direct Known Subclasses:
LazyCreateContext
A read-only Context This version assumes it and all its subcontext are
read-only and any attempt to modify (e.g. through bind) will result in an
OperationNotSupportedException. Each Context in the tree builds a cache of
the entries in all sub-contexts to optimise the performance of lookup.
This implementation is intended to optimise the performance of lookup(String) to about the level of a HashMap get. It has been observed that the scheme resolution phase performed by the JVM takes considerably longer, so for optimum performance lookups should be coded like:
Context componentContext = (Context)new InitialContext().lookup("java:comp");
String envEntry = (String) componentContext.lookup("env/myEntry");
String envEntry2 = (String) componentContext.lookup("env/myEntry2");
$Date: 2005/08/27 03:52:39 $- See Also:
-
Field Summary
FieldsFields 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
ConstructorsModifierConstructorDescriptionReadOnlyContext(Hashtable env) ReadOnlyContext(Hashtable environment, Map<String, Object> bindings) ReadOnlyContext(Hashtable environment, Map bindings, String nameInNamespace) protectedReadOnlyContext(ReadOnlyContext clone, Hashtable env) protectedReadOnlyContext(ReadOnlyContext clone, Hashtable<String, Object> env, String nameInNamespace) -
Method Summary
Modifier and TypeMethodDescriptionaddToEnvironment(String propName, Object propVal) voidvoidvoidclose()composeName(String name, String prefix) composeName(Name name, Name prefix) createSubcontext(String name) createSubcontext(Name name) voiddestroySubcontext(String name) voiddestroySubcontext(Name name) voidfreeze()getNameParser(String name) getNameParser(Name name) internalBind(String name, Object value) internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.listBindings(String name) listBindings(Name name) lookupLink(String name) lookupLink(Name name) protected ReadOnlyContextvoidvoidremoveFromEnvironment(String propName) voidvoidvoidvoid
-
Field Details
-
SEPARATOR
- See Also:
-
NAME_PARSER
-
environment
-
bindings
-
treeBindings
-
-
Constructor Details
-
ReadOnlyContext
public ReadOnlyContext() -
ReadOnlyContext
-
ReadOnlyContext
-
ReadOnlyContext
-
ReadOnlyContext
-
ReadOnlyContext
protected ReadOnlyContext(ReadOnlyContext clone, Hashtable<String, Object> env, String nameInNamespace)
-
-
Method Details
-
freeze
public void freeze() -
internalBind
internalBind is intended for use only during setup or possibly by suitably synchronized superclasses. It binds every possible lookup into a map in each context. To do this, each context strips off one name segment and if necessary creates a new context for it. Then it asks that context to bind the remaining name. It returns a map containing all the bindings from the next context, plus the context it just created (if it in fact created it). (the names are suitably extended by the segment originally lopped off).- Parameters:
name-value-- Returns:
- Throws:
NamingException
-
newContext
-
addToEnvironment
- Specified by:
addToEnvironmentin interfaceContext- Throws:
NamingException
-
getEnvironment
- Specified by:
getEnvironmentin interfaceContext- Throws:
NamingException
-
removeFromEnvironment
- Specified by:
removeFromEnvironmentin interfaceContext- Throws:
NamingException
-
lookup
- Specified by:
lookupin interfaceContext- Throws:
NamingException
-
lookup
- Specified by:
lookupin interfaceContext- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException
-
composeName
- Specified by:
composeNamein interfaceContext- Throws:
NamingException
-
composeName
- Specified by:
composeNamein interfaceContext- Throws:
NamingException
-
list
- Specified by:
listin interfaceContext- Throws:
NamingException
-
listBindings
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException
-
list
- Specified by:
listin interfaceContext- Throws:
NamingException
-
listBindings
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException
-
bind
- Specified by:
bindin interfaceContext- Throws:
NamingException
-
bind
- Specified by:
bindin interfaceContext- Throws:
NamingException
-
close
- Specified by:
closein interfaceContext- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException
-
getNameInNamespace
- Specified by:
getNameInNamespacein interfaceContext- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException
-
rebind
- Specified by:
rebindin interfaceContext- Throws:
NamingException
-
rebind
- Specified by:
rebindin interfaceContext- Throws:
NamingException
-
rename
- Specified by:
renamein interfaceContext- Throws:
NamingException
-
rename
- Specified by:
renamein interfaceContext- Throws:
NamingException
-
unbind
- Specified by:
unbindin interfaceContext- Throws:
NamingException
-
unbind
- Specified by:
unbindin interfaceContext- Throws:
NamingException
-