com.anabas.naming
Class ContextImpl

java.lang.Object
  |
  +--com.anabas.naming.ContextImpl
Direct Known Subclasses:
GND_CollectionImpl, InitialContext

public class ContextImpl
extends java.lang.Object
implements Context

Title: Description: Copyright: Copyright (c) 2000 Company:


Constructor Summary
ContextImpl(java.lang.String parentName, java.lang.String rootName, java.util.Hashtable tree, ContextManager cm)
          Invoked when a tree should be assigned to this conteext.
 
Method Summary
 void bind(java.lang.String name, java.lang.Object obj)
          Will bind an object to the name specified.
 void close()
          Does nothing useful since no resources are reserved.
 Context createSubcontext(java.lang.String name)
          Creates a series of subcontexts such matches the name.
protected  Context createSubcontext(java.lang.String name, ContextInstanceFactory ctxFactory)
          Allow derivative classes to create a context of its own type.
 void destroySubcontext(java.lang.String name)
          Creates a context that represents a particular subtree of the naming directory.
 java.lang.String getAbsoluteName()
           
 java.util.Hashtable getTree()
           
 NamingEnumeration list(java.lang.String name)
           
 java.lang.Object lookup(java.lang.String name)
           
 void rebind(java.lang.String name, java.lang.Object obj)
          Will rebind an object to the name specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextImpl

public ContextImpl(java.lang.String parentName,
                   java.lang.String rootName,
                   java.util.Hashtable tree,
                   ContextManager cm)
Invoked when a tree should be assigned to this conteext.
Method Detail

getAbsoluteName

public java.lang.String getAbsoluteName()

getTree

public java.util.Hashtable getTree()

rebind

public void rebind(java.lang.String name,
                   java.lang.Object obj)
            throws NamingException
Will rebind an object to the name specified. The name can be any valid directory style name a/b/c. The fucntion will traverse down the tree until an error occurrs or the object is bound. If the name does not exist, then it will bind it.
Specified by:
rebind in interface Context
Parameters:
name - Any valid directory style name. i.e. a/b/c
Throws:
NotContextException - If the name ends in a '/' and the object is not a context. Or an object along the directory path should be a context but is not

bind

public void bind(java.lang.String name,
                 java.lang.Object obj)
          throws NamingException
Will bind an object to the name specified. The name can be any valid directory style name a/b/c. The fucntion will traverse down the tree until an error occurrs or the object is bound.
Specified by:
bind in interface Context
Parameters:
name - Any valid directory style name. i.e. a/b/c
Throws:
NameAlreadyBoundException - If the object has already been bound.
NotContextException - If the name ends in a '/' and the object is not a context. Or an object along the directory path should be a context but is not

createSubcontext

protected Context createSubcontext(java.lang.String name,
                                   ContextInstanceFactory ctxFactory)
                            throws InvalidNameException,
                                   NotContextException,
                                   NamingException
Allow derivative classes to create a context of its own type.

createSubcontext

public Context createSubcontext(java.lang.String name)
                         throws NamingException
Creates a series of subcontexts such matches the name.
Specified by:
createSubcontext in interface Context
Parameters:
name - A valid directory name that does not begin with a '/'. i.e. a/b/c or a/b/c/
Throws:
NamingException -  

destroySubcontext

public void destroySubcontext(java.lang.String name)
                       throws NamingException
Creates a context that represents a particular subtree of the naming directory.
Specified by:
destroySubcontext in interface Context
Parameters:
name - A valid directory name that does not begin with a '/'. i.e. a/b/c or a/b/c/
Throws:
NamingException -  

list

public NamingEnumeration list(java.lang.String name)
                       throws NamingException
Specified by:
list in interface Context
Parameters:
name - The name of the context to list bound names for. The name can be contain branches. For example a/b/c is a valid name. A blank name "" will list the current context's keys.
Returns:
A NamingEnumeration listing all names directly under a particular context.
Throws:
NotContextException - if the name specified is not a context.
InvalidNameException - if a part of the name is not a valid name within this context.
NameNotFoundException - if a part of the name does not exist.

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws NamingException
Specified by:
lookup in interface Context
Parameters:
The - name of the object to be retrieved. The name can be of the form a/b/c and must match the UNIX directory syntax.
Returns:
The object matching the name specified.

close

public void close()
           throws NamingException
Does nothing useful since no resources are reserved.
Specified by:
close in interface Context