aicas logo Jamaica 3.4 release 8

com.sun.jndi.toolkit.ctx
Class ComponentContext

java.lang.Object
  extended by com.sun.jndi.toolkit.ctx.PartialCompositeContext
      extended by com.sun.jndi.toolkit.ctx.ComponentContext
All Implemented Interfaces:
Context, Resolver
Direct Known Subclasses:
AtomicContext

public abstract class ComponentContext
extends PartialCompositeContext

Provides implementation of p_* operations using c_* operations provided by subclasses. Clients: deal only with names for its own naming service. Must provide implementations for c_* methods, and for p_parseComponent() and the c_*_nns methods if the defaults are not appropriate.


Field Summary
protected static byte TERMINAL_COMPONENT
           
protected static byte TERMINAL_NNS_COMPONENT
           
protected static byte USE_CONTINUATION
           
 
Fields inherited from class com.sun.jndi.toolkit.ctx.PartialCompositeContext
_ATOMIC, _COMPONENT, _contextType, _PARTIAL
 
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
protected ComponentContext()
           
 
Method Summary
protected  void c_bind_nns(Name name, Object obj, Continuation cont)
           
protected abstract  void c_bind(Name name, Object obj, Continuation cont)
           
protected  Context c_createSubcontext_nns(Name name, Continuation cont)
           
protected abstract  Context c_createSubcontext(Name name, Continuation cont)
           
protected  void c_destroySubcontext_nns(Name name, Continuation cont)
           
protected abstract  void c_destroySubcontext(Name name, Continuation cont)
           
protected  NameParser c_getNameParser_nns(Name name, Continuation cont)
           
protected abstract  NameParser c_getNameParser(Name name, Continuation cont)
           
protected  NamingEnumeration c_list_nns(Name name, Continuation cont)
           
protected abstract  NamingEnumeration c_list(Name name, Continuation cont)
           
protected  NamingEnumeration c_listBindings_nns(Name name, Continuation cont)
           
protected abstract  NamingEnumeration c_listBindings(Name name, Continuation cont)
           
protected  Object c_lookup_nns(Name name, Continuation cont)
           
protected abstract  Object c_lookup(Name name, Continuation cont)
           
protected  Object c_lookupLink_nns(Name name, Continuation cont)
           
protected abstract  Object c_lookupLink(Name name, Continuation cont)
           
protected  void c_processJunction_nns(Name name, Continuation cont)
          Locates the nns using the default policy.
protected  void c_rebind_nns(Name name, Object obj, Continuation cont)
           
protected abstract  void c_rebind(Name name, Object obj, Continuation cont)
           
protected  void c_rename_nns(Name oldname, Name newname, Continuation cont)
           
protected abstract  void c_rename(Name oldname, Name newname, Continuation cont)
           
protected  Object c_resolveIntermediate_nns(Name name, Continuation cont)
          Resolves the nns for 'name' when the named context is acting as an intermediate context.
protected  void c_unbind_nns(Name name, Continuation cont)
           
protected abstract  void c_unbind(Name name, Continuation cont)
           
protected  boolean isAllEmpty(Name n)
           
protected  void p_bind(Name name, Object obj, Continuation cont)
           
protected  Context p_createSubcontext(Name name, Continuation cont)
           
protected  void p_destroySubcontext(Name name, Continuation cont)
           
protected  NameParser p_getNameParser(Name name, Continuation cont)
           
protected  NamingEnumeration p_list(Name name, Continuation cont)
           
protected  NamingEnumeration p_listBindings(Name name, Continuation cont)
           
protected  Object p_lookup(Name name, Continuation cont)
           
protected  Object p_lookupLink(Name name, Continuation cont)
           
protected  HeadTail p_parseComponent(Name name, Continuation cont)
          Determines which of the first components of 'name' belong to this naming system.
protected  void p_rebind(Name name, Object obj, Continuation cont)
           
protected  void p_rename(Name oldName, Name newName, Continuation cont)
           
protected  HeadTail p_resolveIntermediate(Name name, Continuation cont)
          Determine whether 'name' is a terminal component in this naming system.
protected  ResolveResult p_resolveToClass(Name name, Class contextType, Continuation cont)
           
protected  void p_unbind(Name name, Continuation cont)
           
 
Methods inherited from class com.sun.jndi.toolkit.ctx.PartialCompositeContext
allEmpty, bind, bind, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getNameParser, getNameParser, getPCContext, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, p_getEnvironment, rebind, rebind, rename, rename, resolveToClass, resolveToClass, unbind, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.naming.Context
addToEnvironment, close, getEnvironment, getNameInNamespace, removeFromEnvironment
 
Methods inherited from interface javax.naming.spi.Resolver
resolveToClass, resolveToClass
 

Field Detail

USE_CONTINUATION

protected static final byte USE_CONTINUATION
See Also:
Constant Field Values

TERMINAL_COMPONENT

protected static final byte TERMINAL_COMPONENT
See Also:
Constant Field Values

TERMINAL_NNS_COMPONENT

protected static final byte TERMINAL_NNS_COMPONENT
See Also:
Constant Field Values
Constructor Detail

ComponentContext

protected ComponentContext()
Method Detail

c_lookup

protected abstract Object c_lookup(Name name,
                                   Continuation cont)
                            throws NamingException
Throws:
NamingException

c_lookupLink

protected abstract Object c_lookupLink(Name name,
                                       Continuation cont)
                                throws NamingException
Throws:
NamingException

c_list

protected abstract NamingEnumeration c_list(Name name,
                                            Continuation cont)
                                     throws NamingException
Throws:
NamingException

c_listBindings

protected abstract NamingEnumeration c_listBindings(Name name,
                                                    Continuation cont)
                                             throws NamingException
Throws:
NamingException

c_bind

protected abstract void c_bind(Name name,
                               Object obj,
                               Continuation cont)
                        throws NamingException
Throws:
NamingException

c_rebind

protected abstract void c_rebind(Name name,
                                 Object obj,
                                 Continuation cont)
                          throws NamingException
Throws:
NamingException

c_unbind

protected abstract void c_unbind(Name name,
                                 Continuation cont)
                          throws NamingException
Throws:
NamingException

c_destroySubcontext

protected abstract void c_destroySubcontext(Name name,
                                            Continuation cont)
                                     throws NamingException
Throws:
NamingException

c_createSubcontext

protected abstract Context c_createSubcontext(Name name,
                                              Continuation cont)
                                       throws NamingException
Throws:
NamingException

c_rename

protected abstract void c_rename(Name oldname,
                                 Name newname,
                                 Continuation cont)
                          throws NamingException
Throws:
NamingException

c_getNameParser

protected abstract NameParser c_getNameParser(Name name,
                                              Continuation cont)
                                       throws NamingException
Throws:
NamingException

p_parseComponent

protected HeadTail p_parseComponent(Name name,
                                    Continuation cont)
                             throws NamingException
Determines which of the first components of 'name' belong to this naming system. If no components belong to this naming system, return the empty name (new CompositeName()) as the head, and the entire name as the tail. The default implementation supports strong separation. If the name is empty or if the first component is empty, head is the empty name and tail is the entire name. (This means that this context does not have any name to work with). Otherwise, it returns the first component as head, and the rest of the components as tail. Subclass should override this method according its own policies. For example, a weakly separated system with dynamic boundary determination would simply return as head 'name'. A weakly separated with static boundary determination would select the components in the front of 'name' that conform to some syntax rules. (e.g. in X.500 syntax, perhaps select front components that have a equal sign). If none conforms, return an empty name.

Throws:
NamingException

c_resolveIntermediate_nns

protected Object c_resolveIntermediate_nns(Name name,
                                           Continuation cont)
                                    throws NamingException
Resolves the nns for 'name' when the named context is acting as an intermediate context. For a system that supports only junctions, this would be equilvalent to c_lookup(name, cont); because for junctions, an intermediate slash simply signifies a syntactic separator. For a system that supports only implicit nns, this would be equivalent to c_lookup_nns(name, cont); because for implicit nns, a slash always signifies the implicit nns, regardless of whether it is intermediate or trailing. By default this method supports junctions, and also allows for an implicit nns to be dynamically determined through the use of the "nns" reference (see c_processJunction_nns()). Contexts that implement implicit nns directly should provide an appropriate override. A junction, by definition, is a binding of a name in one namespace to an object in another. The default implementation of this method detects the crossover into another namespace using the following heuristic: there is a junction when "name" resolves to a context that is not an instance of this.getClass(). Contexts supporting junctions for which this heuristic is inappropriate should override this method.

Throws:
NamingException

c_lookup_nns

protected Object c_lookup_nns(Name name,
                              Continuation cont)
                       throws NamingException
Throws:
NamingException

c_lookupLink_nns

protected Object c_lookupLink_nns(Name name,
                                  Continuation cont)
                           throws NamingException
Throws:
NamingException

c_list_nns

protected NamingEnumeration c_list_nns(Name name,
                                       Continuation cont)
                                throws NamingException
Throws:
NamingException

c_listBindings_nns

protected NamingEnumeration c_listBindings_nns(Name name,
                                               Continuation cont)
                                        throws NamingException
Throws:
NamingException

c_bind_nns

protected void c_bind_nns(Name name,
                          Object obj,
                          Continuation cont)
                   throws NamingException
Throws:
NamingException

c_rebind_nns

protected void c_rebind_nns(Name name,
                            Object obj,
                            Continuation cont)
                     throws NamingException
Throws:
NamingException

c_unbind_nns

protected void c_unbind_nns(Name name,
                            Continuation cont)
                     throws NamingException
Throws:
NamingException

c_createSubcontext_nns

protected Context c_createSubcontext_nns(Name name,
                                         Continuation cont)
                                  throws NamingException
Throws:
NamingException

c_destroySubcontext_nns

protected void c_destroySubcontext_nns(Name name,
                                       Continuation cont)
                                throws NamingException
Throws:
NamingException

c_rename_nns

protected void c_rename_nns(Name oldname,
                            Name newname,
                            Continuation cont)
                     throws NamingException
Throws:
NamingException

c_getNameParser_nns

protected NameParser c_getNameParser_nns(Name name,
                                         Continuation cont)
                                  throws NamingException
Throws:
NamingException

c_processJunction_nns

protected void c_processJunction_nns(Name name,
                                     Continuation cont)
                              throws NamingException
Locates the nns using the default policy. This policy fully handles junctions, but otherwise throws an exception when an attempt is made to resolve an implicit nns. The default policy is as follows: If there is a junction in the namespace, then resolve to the junction and continue the operation there (thus deferring to that context to find its own nns). Otherwise, resolve as far as possible and then throw CannotProceedException with the resolved object being a reference: the address type is "nns", and the address contents is this context. For example, when c_bind_nns(name, obj, ...) is invoked, the caller is attempting to bind the object "obj" to the nns of "name". If "name" is a junction, it names an object in another naming system that (presumably) has an nns. c_bind_nns() will first resolve "name" to a context and then attempt to continue the bind operation there, (thus binding to the nns of the context named by "name"). If "name" is empty then throw an exception, since this context does not by default support an implicit nns. To implement a context that does support an implicit nns, it is necessary to override this default policy. This is done by overriding the c_*_nns() methods (which each call this method by default).

Throws:
NamingException

p_resolveIntermediate

protected HeadTail p_resolveIntermediate(Name name,
                                         Continuation cont)
                                  throws NamingException
Determine whether 'name' is a terminal component in this naming system. If so, return status indicating so, so that caller can perform context operation on this name. If not, then the first component(s) of 'name' names an intermediate context. In that case, resolve these components and set Continuation to be the object named. see test cases at bottom of file.

Throws:
NamingException

isAllEmpty

protected boolean isAllEmpty(Name n)

p_resolveToClass

protected ResolveResult p_resolveToClass(Name name,
                                         Class contextType,
                                         Continuation cont)
                                  throws NamingException
Specified by:
p_resolveToClass in class PartialCompositeContext
Throws:
NamingException

p_lookup

protected Object p_lookup(Name name,
                          Continuation cont)
                   throws NamingException
Specified by:
p_lookup in class PartialCompositeContext
Throws:
NamingException

p_list

protected NamingEnumeration p_list(Name name,
                                   Continuation cont)
                            throws NamingException
Specified by:
p_list in class PartialCompositeContext
Throws:
NamingException

p_listBindings

protected NamingEnumeration p_listBindings(Name name,
                                           Continuation cont)
                                    throws NamingException
Specified by:
p_listBindings in class PartialCompositeContext
Throws:
NamingException

p_bind

protected void p_bind(Name name,
                      Object obj,
                      Continuation cont)
               throws NamingException
Specified by:
p_bind in class PartialCompositeContext
Throws:
NamingException

p_rebind

protected void p_rebind(Name name,
                        Object obj,
                        Continuation cont)
                 throws NamingException
Specified by:
p_rebind in class PartialCompositeContext
Throws:
NamingException

p_unbind

protected void p_unbind(Name name,
                        Continuation cont)
                 throws NamingException
Specified by:
p_unbind in class PartialCompositeContext
Throws:
NamingException

p_destroySubcontext

protected void p_destroySubcontext(Name name,
                                   Continuation cont)
                            throws NamingException
Specified by:
p_destroySubcontext in class PartialCompositeContext
Throws:
NamingException

p_createSubcontext

protected Context p_createSubcontext(Name name,
                                     Continuation cont)
                              throws NamingException
Specified by:
p_createSubcontext in class PartialCompositeContext
Throws:
NamingException

p_rename

protected void p_rename(Name oldName,
                        Name newName,
                        Continuation cont)
                 throws NamingException
Specified by:
p_rename in class PartialCompositeContext
Throws:
NamingException

p_getNameParser

protected NameParser p_getNameParser(Name name,
                                     Continuation cont)
                              throws NamingException
Specified by:
p_getNameParser in class PartialCompositeContext
Throws:
NamingException

p_lookupLink

protected Object p_lookupLink(Name name,
                              Continuation cont)
                       throws NamingException
Specified by:
p_lookupLink in class PartialCompositeContext
Throws:
NamingException

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.