Save This Page
Home » openjdk-7 » com.sun.jndi » ldap » [javadoc | source]
com.sun.jndi.ldap
public final class: LdapCtx [javadoc | source]
java.lang.Object
   com.sun.jndi.toolkit.ctx.PartialCompositeContext
      com.sun.jndi.toolkit.ctx.ComponentContext
         com.sun.jndi.toolkit.ctx.AtomicContext
            com.sun.jndi.toolkit.ctx.PartialCompositeDirContext
               com.sun.jndi.toolkit.ctx.ComponentDirContext
                  com.sun.jndi.ldap.LdapCtx

All Implemented Interfaces:
    LdapContext, EventDirContext, DirContext, Context, Resolver

The LDAP context implementation. Implementation is not thread-safe. Caller must sync as per JNDI spec. Members that are used directly or indirectly by internal worker threads (Connection, EventQueue, NamingEventNotifier) must be thread-safe. Connection - calls LdapClient.processUnsolicited(), which in turn calls LdapCtx.convertControls() and LdapCtx.fireUnsolicited(). convertControls() - no sync; reads envprops and 'this' fireUnsolicited() - sync on eventSupport for all references to 'unsolicited' (even those in other methods); don't sync on LdapCtx in case caller is already sync'ing on it - this would prevent Unsol events from firing and the Connection thread to block (thus preventing any other data from being read from the connection) References to 'eventSupport' need not be sync'ed because these methods can only be called after eventSupport has been set first (via addNamingListener()). EventQueue - no direct or indirect calls to LdapCtx NamingEventNotifier - calls newInstance() to get instance for run() to use; no sync needed for methods invoked on new instance; LdapAttribute links to LdapCtx in order to process getAttributeDefinition() and getAttributeSyntaxDefinition() calls. It invokes LdapCtx.getSchema(), which uses schemaTrees (a Hashtable - already sync). Potential conflict of duplicating construction of tree for same subschemasubentry but no inconsistency problems. NamingEnumerations link to LdapCtx for the following: 1. increment/decrement enum count so that ctx doesn't close the underlying connection 2. LdapClient handle to get next batch of results 3. Sets LdapCtx's response controls 4. Process return code 5. For narrowing response controls (using ctx's factories) Since processing of NamingEnumeration by client is treated the same as method invocation on LdapCtx, caller is responsible for locking.
Nested Class Summary:
static final class  LdapCtx.SearchArgs   
Field Summary
public static final  int DEFAULT_PORT     
public static final  int DEFAULT_SSL_PORT     
public static final  String DEFAULT_HOST     
static final  String DEFAULT_SSL_FACTORY     
static final  String BIND_CONTROLS     
 int port_number     
 String hostname     
 LdapClient clnt     
 Hashtable envprops     
 int handleReferrals     
 boolean hasLdapsScheme     
 String currentDN     
 Name currentParsedDN     
 Vector respCtls     
 Control[] reqCtls     
Fields inherited from com.sun.jndi.toolkit.ctx.ComponentContext:
USE_CONTINUATION,  TERMINAL_COMPONENT,  TERMINAL_NNS_COMPONENT
Fields inherited from com.sun.jndi.toolkit.ctx.PartialCompositeContext:
_PARTIAL,  _COMPONENT,  _ATOMIC,  _contextType,  _EMPTY_NAME,  _NNS_NAME
Constructor:
 LdapCtx(LdapCtx existing,
    String newDN) throws NamingException 
 public LdapCtx(String dn,
    String host,
    int port_number,
    Hashtable props,
    boolean useSsl) throws NamingException 
Method from com.sun.jndi.ldap.LdapCtx Summary:
addNamingListener,   addNamingListener,   addNamingListener,   addNamingListener,   addNamingListener,   addNamingListener,   addToEnvironment,   c_bind,   c_bind,   c_createSubcontext,   c_createSubcontext,   c_destroySubcontext,   c_getAttributes,   c_getNameParser,   c_getSchema,   c_getSchemaClassDefinition,   c_list,   c_listBindings,   c_lookup,   c_lookupLink,   c_modifyAttributes,   c_modifyAttributes,   c_rebind,   c_rebind,   c_rename,   c_search,   c_search,   c_search,   c_search,   c_unbind,   close,   composeName,   convertControls,   decEnumCount,   extendedOperation,   finalize,   fireUnsolicited,   getConnectControls,   getEnvironment,   getNameInNamespace,   getRequestControls,   getResponseControls,   getSearchReply,   getURL,   incEnumCount,   mapErrorCode,   newInstance,   p_getEnvironment,   processReturnCode,   processReturnCode,   processReturnCode,   reconnect,   removeFromEnvironment,   removeNamingListener,   searchAux,   setDomainName,   setHopCount,   setParents,   setProviderUrl,   setRequestControls,   targetMustExist
Methods from com.sun.jndi.toolkit.ctx.ComponentDirContext:
c_bind,   c_bind_nns,   c_createSubcontext,   c_createSubcontext_nns,   c_getAttributes,   c_getAttributes_nns,   c_getSchema,   c_getSchemaClassDefinition,   c_getSchemaClassDefinition_nns,   c_getSchema_nns,   c_modifyAttributes,   c_modifyAttributes,   c_modifyAttributes_nns,   c_modifyAttributes_nns,   c_rebind,   c_rebind_nns,   c_search,   c_search,   c_search,   c_search_nns,   c_search_nns,   c_search_nns,   p_bind,   p_createSubcontext,   p_getAttributes,   p_getSchema,   p_getSchemaClassDefinition,   p_modifyAttributes,   p_modifyAttributes,   p_rebind,   p_search,   p_search,   p_search
Methods from com.sun.jndi.toolkit.ctx.PartialCompositeDirContext:
a_bind,   a_createSubcontext,   a_destroySubcontext,   a_getNameParser,   a_list,   a_listBindings,   a_lookup,   a_lookupLink,   a_rebind,   a_rename,   a_unbind,   bind,   bind,   c_parseComponent,   createSubcontext,   createSubcontext,   getAttributes,   getAttributes,   getAttributes,   getAttributes,   getPCDirContext,   getSchema,   getSchema,   getSchemaClassDefinition,   getSchemaClassDefinition,   modifyAttributes,   modifyAttributes,   modifyAttributes,   modifyAttributes,   p_bind,   p_createSubcontext,   p_getAttributes,   p_getSchema,   p_getSchemaClassDefinition,   p_modifyAttributes,   p_modifyAttributes,   p_rebind,   p_search,   p_search,   p_search,   rebind,   rebind,   search,   search,   search,   search,   search,   search,   search,   search
Methods from com.sun.jndi.toolkit.ctx.AtomicContext:
a_bind,   a_bind_nns,   a_createSubcontext,   a_createSubcontext_nns,   a_destroySubcontext,   a_destroySubcontext_nns,   a_getNameParser,   a_getNameParser_nns,   a_list,   a_listBindings,   a_listBindings_nns,   a_list_nns,   a_lookup,   a_lookupLink,   a_lookupLink_nns,   a_lookup_nns,   a_processJunction_nns,   a_processJunction_nns,   a_rebind,   a_rebind_nns,   a_rename,   a_rename_nns,   a_resolveIntermediate_nns,   a_unbind,   a_unbind_nns,   c_bind,   c_bind_nns,   c_createSubcontext,   c_createSubcontext_nns,   c_destroySubcontext,   c_destroySubcontext_nns,   c_getNameParser,   c_getNameParser_nns,   c_list,   c_listBindings,   c_listBindings_nns,   c_list_nns,   c_lookup,   c_lookupLink,   c_lookupLink_nns,   c_lookup_nns,   c_parseComponent,   c_rebind,   c_rebind_nns,   c_rename,   c_rename_nns,   c_resolveIntermediate_nns,   c_unbind,   c_unbind_nns,   isEmpty,   resolve_to_context,   resolve_to_nns_and_continue,   resolve_to_penultimate_context,   resolve_to_penultimate_context_nns
Methods from com.sun.jndi.toolkit.ctx.ComponentContext:
c_bind,   c_bind_nns,   c_createSubcontext,   c_createSubcontext_nns,   c_destroySubcontext,   c_destroySubcontext_nns,   c_getNameParser,   c_getNameParser_nns,   c_list,   c_listBindings,   c_listBindings_nns,   c_list_nns,   c_lookup,   c_lookupLink,   c_lookupLink_nns,   c_lookup_nns,   c_processJunction_nns,   c_rebind,   c_rebind_nns,   c_rename,   c_rename_nns,   c_resolveIntermediate_nns,   c_unbind,   c_unbind_nns,   checkAndAdjustRemainingName,   isAllEmpty,   p_bind,   p_createSubcontext,   p_destroySubcontext,   p_getNameParser,   p_list,   p_listBindings,   p_lookup,   p_lookupLink,   p_parseComponent,   p_rebind,   p_rename,   p_resolveIntermediate,   p_resolveToClass,   p_unbind
Methods from 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_bind,   p_createSubcontext,   p_destroySubcontext,   p_getEnvironment,   p_getNameParser,   p_list,   p_listBindings,   p_lookup,   p_lookupLink,   p_rebind,   p_rename,   p_resolveToClass,   p_unbind,   rebind,   rebind,   rename,   rename,   resolveToClass,   resolveToClass,   unbind,   unbind
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.jndi.ldap.LdapCtx Detail:
 public  void addNamingListener(Name nm,
    int scope,
    NamingListener l) throws NamingException 
 public  void addNamingListener(String nm,
    int scope,
    NamingListener l) throws NamingException 
 public  void addNamingListener(String nm,
    String filter,
    SearchControls ctls,
    NamingListener l) throws NamingException 
 public  void addNamingListener(Name nm,
    String filter,
    SearchControls ctls,
    NamingListener l) throws NamingException 
 public  void addNamingListener(Name nm,
    String filter,
    Object[] filterArgs,
    SearchControls ctls,
    NamingListener l) throws NamingException 
 public  void addNamingListener(String nm,
    String filterExpr,
    Object[] filterArgs,
    SearchControls ctls,
    NamingListener l) throws NamingException 
 public Object addToEnvironment(String propName,
    Object propVal) throws NamingException 
 protected  void c_bind(Name name,
    Object obj,
    Continuation cont) throws NamingException 
 protected  void c_bind(Name name,
    Object obj,
    Attributes attrs,
    Continuation cont) throws NamingException 
 protected Context c_createSubcontext(Name name,
    Continuation cont) throws NamingException 
 protected DirContext c_createSubcontext(Name name,
    Attributes attrs,
    Continuation cont) throws NamingException 
 protected  void c_destroySubcontext(Name name,
    Continuation cont) throws NamingException 
 protected Attributes c_getAttributes(Name name,
    String[] attrIds,
    Continuation cont) throws NamingException 
 protected NameParser c_getNameParser(Name name,
    Continuation cont) throws NamingException 
 protected DirContext c_getSchema(Name name,
    Continuation cont) throws NamingException 
 protected DirContext c_getSchemaClassDefinition(Name name,
    Continuation cont) throws NamingException 
 protected NamingEnumeration c_list(Name name,
    Continuation cont) throws NamingException 
 protected NamingEnumeration c_listBindings(Name name,
    Continuation cont) throws NamingException 
 protected Object c_lookup(Name name,
    Continuation cont) throws NamingException 
 protected Object c_lookupLink(Name name,
    Continuation cont) throws NamingException 
 protected  void c_modifyAttributes(Name name,
    ModificationItem[] mods,
    Continuation cont) throws NamingException 
 protected  void c_modifyAttributes(Name name,
    int mod_op,
    Attributes attrs,
    Continuation cont) throws NamingException 
 protected  void c_rebind(Name name,
    Object obj,
    Continuation cont) throws NamingException 
 protected  void c_rebind(Name name,
    Object obj,
    Attributes attrs,
    Continuation cont) throws NamingException 
 protected  void c_rename(Name oldName,
    Name newName,
    Continuation cont) throws NamingException 
 protected NamingEnumeration c_search(Name name,
    Attributes matchingAttributes,
    Continuation cont) throws NamingException 
 protected NamingEnumeration c_search(Name name,
    Attributes matchingAttributes,
    String[] attributesToReturn,
    Continuation cont) throws NamingException 
 protected NamingEnumeration c_search(Name name,
    String filter,
    SearchControls cons,
    Continuation cont) throws NamingException 
 protected NamingEnumeration c_search(Name name,
    String filterExpr,
    Object[] filterArgs,
    SearchControls cons,
    Continuation cont) throws NamingException 
 protected  void c_unbind(Name name,
    Continuation cont) throws NamingException 
 public synchronized  void close() throws NamingException 
 public Name composeName(Name name,
    Name prefix) throws NamingException 
 Control[] convertControls(Vector ctls) throws NamingException 
    Narrow controls using own default factory and ControlFactory.
 synchronized  void decEnumCount() 
 public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException 
 protected  void finalize() 
  void fireUnsolicited(Object obj) 
    Uses EventSupport to fire an event related to an unsolicited notification. Called by LdapClient when LdapClient receives an unsolicited notification.
 public Control[] getConnectControls() throws NamingException 
 public Hashtable getEnvironment() throws NamingException 
 public String getNameInNamespace() 
 public Control[] getRequestControls() throws NamingException 
 public Control[] getResponseControls() throws NamingException 
 LdapResult getSearchReply(LdapClient eClnt,
    LdapResult res) throws NamingException 
 String getURL() 
 synchronized  void incEnumCount() 
 public static NamingException mapErrorCode(int errorCode,
    String errorMessage) 
    Maps an LDAP error code to an appropriate NamingException. %%% public; used by controls
 public LdapContext newInstance(Control[] reqCtls) throws NamingException 
 protected Hashtable p_getEnvironment() 
    Override with noncloning version.
 protected  void processReturnCode(LdapResult answer) throws NamingException 
  void processReturnCode(LdapResult answer,
    Name remainName) throws NamingException 
 protected  void processReturnCode(LdapResult res,
    Name resolvedName,
    Object resolvedObj,
    Name remainName,
    Hashtable envprops,
    String fullDN) throws NamingException 
 public  void reconnect(Control[] connCtls) throws NamingException 
 public Object removeFromEnvironment(String propName) throws NamingException 
 public  void removeNamingListener(NamingListener l) throws NamingException 
 NamingEnumeration searchAux(Name name,
    String filter,
    SearchControls cons,
    boolean relative,
    boolean waitForReply,
    Continuation cont) throws NamingException 
  void setDomainName(String domainName) 
    Sets the domain name for the context in the com.sun.jndi.ldap.domainname property. Used for hostname verification by Start TLS
  void setHopCount(int hopCount) 
  void setParents(Attributes attrs,
    Name name) throws NamingException 
  void setProviderUrl(String providerUrl) 
    Sets the URL that created the context in the java.naming.provider.url property.
 public  void setRequestControls(Control[] reqCtls) throws NamingException 
 public boolean targetMustExist()