Home » geronimo-2.2-source-release » org.apache.geronimo.naming.java » [javadoc | source]
org.apache.geronimo.naming.java
public class: ReadOnlyContext [javadoc | source]
java.lang.Object
   org.apache.geronimo.naming.java.ReadOnlyContext

All Implemented Interfaces:
    Context, Serializable

Direct Known Subclasses:
    GeronimoContext, GeronimoRootContext, SimpleReadOnlyContext

A read-only Context in the java: namespace.

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");
Field Summary
protected final  Hashtable env     
protected final  Map bindings     
protected final  Map treeBindings     
Constructor:
 public ReadOnlyContext() 
 ReadOnlyContext(Hashtable env) 
 protected ReadOnlyContext(ReadOnlyContext clone,
    Hashtable env) 
Method from org.apache.geronimo.naming.java.ReadOnlyContext Summary:
addToEnvironment,   bind,   bind,   close,   composeName,   composeName,   createSubcontext,   createSubcontext,   destroySubcontext,   destroySubcontext,   freeze,   getEnvironment,   getNameInNamespace,   getNameParser,   getNameParser,   internalBind,   isFrozen,   list,   list,   listBindings,   listBindings,   lookup,   lookup,   lookupLink,   lookupLink,   newContext,   rebind,   rebind,   removeFromEnvironment,   rename,   rename,   setClassLoader,   setKernel,   unbind,   unbind
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.geronimo.naming.java.ReadOnlyContext Detail:
 public Object addToEnvironment(String propName,
    Object propVal) throws NamingException 
 public  void bind(Name name,
    Object obj) throws NamingException 
 public  void bind(String name,
    Object obj) throws NamingException 
 public  void close() throws NamingException 
 public Name composeName(Name name,
    Name prefix) throws NamingException 
 public String composeName(String name,
    String prefix) throws NamingException 
 public Context createSubcontext(Name name) throws NamingException 
 public Context createSubcontext(String name) throws NamingException 
 public  void destroySubcontext(Name name) throws NamingException 
 public  void destroySubcontext(String name) throws NamingException 
 public  void freeze() 
 public Hashtable getEnvironment() throws NamingException 
 public String getNameInNamespace() throws NamingException 
 public NameParser getNameParser(Name name) throws NamingException 
 public NameParser getNameParser(String name) throws NamingException 
 protected Map internalBind(String name,
    Object value) throws NamingException 
    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).
 boolean isFrozen() 
 public NamingEnumeration list(String name) throws NamingException 
 public NamingEnumeration list(Name name) throws NamingException 
 public NamingEnumeration listBindings(String name) throws NamingException 
 public NamingEnumeration listBindings(Name name) throws NamingException 
 public Object lookup(String name) throws NamingException 
 public Object lookup(Name name) throws NamingException 
 public Object lookupLink(String name) throws NamingException 
 public Object lookupLink(Name name) throws NamingException 
 protected ReadOnlyContext newContext() 
 public  void rebind(Name name,
    Object obj) throws NamingException 
 public  void rebind(String name,
    Object obj) throws NamingException 
 public Object removeFromEnvironment(String propName) throws NamingException 
 public  void rename(Name oldName,
    Name newName) throws NamingException 
 public  void rename(String oldName,
    String newName) throws NamingException 
 public  void setClassLoader(ClassLoader classLoader) 
 public  void setKernel(Kernel kernel) 
 public  void unbind(Name name) throws NamingException 
 public  void unbind(String name) throws NamingException