aicas logo Jamaica 3.4 release 8

com.sun.jndi.toolkit.ctx
Class PartialCompositeContext

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

public abstract class PartialCompositeContext
extends Object
implements Context, Resolver

PartialCompositeContext implements Context operations on composite names using implementations of the p_ interfaces defined by its subclasses. The main purpose provided by this class is that it deals with partial resolutions and continuations, so that callers of the Context operation don't have to. Types of clients that will be direct subclasses of PartialCompositeContext may be service providers that implement one of the JNDI protocols, but which do not deal with continuations. Usually, service providers will be using one of the subclasses of PartialCompositeContext.


Field Summary
protected static int _ATOMIC
           
protected static int _COMPONENT
           
protected  int _contextType
           
protected static int _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 PartialCompositeContext()
           
 
Method Summary
protected static boolean allEmpty(Name name)
          Tests whether a name contains a nonempty component.
 void bind(Name name, Object newObj)
           
 void bind(String name, Object newObj)
           
 Name composeName(Name name, Name prefix)
          This default implementation simply concatenates the two names.
 String composeName(String name, String prefix)
           
 Context createSubcontext(Name name)
           
 Context createSubcontext(String name)
           
 void destroySubcontext(Name name)
           
 void destroySubcontext(String name)
           
 NameParser getNameParser(Name name)
           
 NameParser getNameParser(String name)
           
protected static PartialCompositeContext getPCContext(Continuation cont)
          Retrieves a PartialCompositeContext for the resolved object in cont.
  list(Name name)
           
  list(String name)
           
  listBindings(Name name)
           
  listBindings(String name)
           
 Object lookup(Name name)
           
 Object lookup(String name)
           
 Object lookupLink(Name name)
           
 Object lookupLink(String name)
           
protected abstract  void p_bind(Name name, Object obj, Continuation cont)
           
protected abstract  Context p_createSubcontext(Name name, Continuation cont)
           
protected abstract  void p_destroySubcontext(Name name, Continuation cont)
           
protected  Hashtable p_getEnvironment()
          A cheap way of getting the environment.
protected abstract  NameParser p_getNameParser(Name name, Continuation cont)
           
protected abstract  NamingEnumeration p_list(Name name, Continuation cont)
           
protected abstract  NamingEnumeration p_listBindings(Name name, Continuation cont)
           
protected abstract  Object p_lookup(Name name, Continuation cont)
           
protected abstract  Object p_lookupLink(Name name, Continuation cont)
           
protected abstract  void p_rebind(Name name, Object obj, Continuation cont)
           
protected abstract  void p_rename(Name oldname, Name newname, Continuation cont)
           
protected abstract  ResolveResult p_resolveToClass(Name name, Class contextType, Continuation cont)
           
protected abstract  void p_unbind(Name name, Continuation cont)
           
 void rebind(Name name, Object newObj)
           
 void rebind(String name, Object newObj)
           
 void rename(Name oldName, Name newName)
           
 void rename(String oldName, String newName)
           
 ResolveResult resolveToClass(Name name, Class<? extends Context> contextType)
           
 ResolveResult resolveToClass(String name, Class<? extends Context> contextType)
           
 void unbind(Name name)
           
 void unbind(String name)
           
 
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

_PARTIAL

protected static final int _PARTIAL
See Also:
Constant Field Values

_COMPONENT

protected static final int _COMPONENT
See Also:
Constant Field Values

_ATOMIC

protected static final int _ATOMIC
See Also:
Constant Field Values

_contextType

protected int _contextType
Constructor Detail

PartialCompositeContext

protected PartialCompositeContext()
Method Detail

p_resolveToClass

protected abstract ResolveResult p_resolveToClass(Name name,
                                                  Class contextType,
                                                  Continuation cont)
                                           throws NamingException
Throws:
NamingException

p_lookup

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

p_lookupLink

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

p_list

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

p_listBindings

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

p_bind

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

p_rebind

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

p_unbind

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

p_destroySubcontext

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

p_createSubcontext

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

p_rename

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

p_getNameParser

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

p_getEnvironment

protected Hashtable p_getEnvironment()
                              throws NamingException
A cheap way of getting the environment. Default implemenation is NOT cheap because it simply calls getEnvironment(), which most implementations clone before returning. Subclass should ALWAYS override this with the cheapest possible way. The toolkit knows to clone when necessary.

Returns:
The possibly null environment of the context.
Throws:
NamingException

resolveToClass

public ResolveResult resolveToClass(String name,
                                    Class<? extends Context> contextType)
                             throws NamingException
Throws:
NamingException

resolveToClass

public ResolveResult resolveToClass(Name name,
                                    Class<? extends Context> contextType)
                             throws NamingException
Throws:
NamingException

lookup

public Object lookup(String name)
              throws NamingException
Specified by:
lookup in interface Context
Throws:
NamingException

lookup

public Object lookup(Name name)
              throws NamingException
Specified by:
lookup in interface Context
Throws:
NamingException

bind

public void bind(String name,
                 Object newObj)
          throws NamingException
Specified by:
bind in interface Context
Throws:
NamingException

bind

public void bind(Name name,
                 Object newObj)
          throws NamingException
Specified by:
bind in interface Context
Throws:
NamingException

rebind

public void rebind(String name,
                   Object newObj)
            throws NamingException
Specified by:
rebind in interface Context
Throws:
NamingException

rebind

public void rebind(Name name,
                   Object newObj)
            throws NamingException
Specified by:
rebind in interface Context
Throws:
NamingException

unbind

public void unbind(String name)
            throws NamingException
Specified by:
unbind in interface Context
Throws:
NamingException

unbind

public void unbind(Name name)
            throws NamingException
Specified by:
unbind in interface Context
Throws:
NamingException

rename

public void rename(String oldName,
                   String newName)
            throws NamingException
Specified by:
rename in interface Context
Throws:
NamingException

rename

public void rename(Name oldName,
                   Name newName)
            throws NamingException
Specified by:
rename in interface Context
Throws:
NamingException

list

public  list(String name)
           throws NamingException
Specified by:
list in interface Context
Throws:
NamingException

list

public  list(Name name)
           throws NamingException
Specified by:
list in interface Context
Throws:
NamingException

listBindings

public  listBindings(String name)
                   throws NamingException
Specified by:
listBindings in interface Context
Throws:
NamingException

listBindings

public  listBindings(Name name)
                   throws NamingException
Specified by:
listBindings in interface Context
Throws:
NamingException

destroySubcontext

public void destroySubcontext(String name)
                       throws NamingException
Specified by:
destroySubcontext in interface Context
Throws:
NamingException

destroySubcontext

public void destroySubcontext(Name name)
                       throws NamingException
Specified by:
destroySubcontext in interface Context
Throws:
NamingException

createSubcontext

public Context createSubcontext(String name)
                         throws NamingException
Specified by:
createSubcontext in interface Context
Throws:
NamingException

createSubcontext

public Context createSubcontext(Name name)
                         throws NamingException
Specified by:
createSubcontext in interface Context
Throws:
NamingException

lookupLink

public Object lookupLink(String name)
                  throws NamingException
Specified by:
lookupLink in interface Context
Throws:
NamingException

lookupLink

public Object lookupLink(Name name)
                  throws NamingException
Specified by:
lookupLink in interface Context
Throws:
NamingException

getNameParser

public NameParser getNameParser(String name)
                         throws NamingException
Specified by:
getNameParser in interface Context
Throws:
NamingException

getNameParser

public NameParser getNameParser(Name name)
                         throws NamingException
Specified by:
getNameParser in interface Context
Throws:
NamingException

composeName

public String composeName(String name,
                          String prefix)
                   throws NamingException
Specified by:
composeName in interface Context
Throws:
NamingException

composeName

public Name composeName(Name name,
                        Name prefix)
                 throws NamingException
This default implementation simply concatenates the two names. There's one twist when the "java.naming.provider.compose.elideEmpty" environment setting is set to "true": if each name contains a nonempty component, and if 'prefix' ends with an empty component or 'name' starts with one, then one empty component is dropped. For example:
                            elideEmpty=false     elideEmpty=true
 {"a"} + {"b"}          =>  {"a", "b"}           {"a", "b"}
 {"a"} + {""}           =>  {"a", ""}            {"a", ""}
 {"a"} + {"", "b"}      =>  {"a", "", "b"}       {"a", "b"}
 {"a", ""} + {"b", ""}  =>  {"a", "", "b", ""}   {"a", "b", ""}
 {"a", ""} + {"", "b"}  =>  {"a", "", "", "b"}   {"a", "", "b"}
 

Specified by:
composeName in interface Context
Throws:
NamingException

allEmpty

protected static boolean allEmpty(Name name)
Tests whether a name contains a nonempty component.


getPCContext

protected static PartialCompositeContext getPCContext(Continuation cont)
                                               throws NamingException
Retrieves a PartialCompositeContext for the resolved object in cont. Throws CannotProceedException if not successful.

Throws:
NamingException

aicas logo Jamaica 3.4 release 8

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