Spring LDAP

org.springframework.ldap.pool
Class DelegatingLdapContext

java.lang.Object
  extended by org.springframework.ldap.pool.DelegatingContext
      extended by org.springframework.ldap.pool.DelegatingDirContext
          extended by org.springframework.ldap.pool.DelegatingLdapContext
All Implemented Interfaces:
Context, DirContext, LdapContext, DirContextProxy
Direct Known Subclasses:
MutableDelegatingLdapContext

public class DelegatingLdapContext
extends DelegatingDirContext
implements LdapContext

Used by PoolingContextSource to wrap a LdapContext, delegating most methods to the underlying context. This class extends DelegatingDirContext which handles returning the context to the pool on a call to close()

Author:
Eric Dalquist

Field Summary
 
Fields inherited from interface javax.naming.ldap.LdapContext
CONTROL_FACTORIES
 
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
 
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
DelegatingLdapContext(KeyedObjectPool keyedObjectPool, LdapContext delegateLdapContext, DirContextType dirContextType)
          Create a new delegating ldap context for the specified pool, context and context type.
 
Method Summary
protected  void assertOpen()
           
 void close()
           
 boolean equals(Object obj)
           
 ExtendedResponse extendedOperation(ExtendedRequest request)
           
 Control[] getConnectControls()
           
 DirContext getDelegateDirContext()
           
 LdapContext getDelegateLdapContext()
           
 LdapContext getInnermostDelegateLdapContext()
          Recursivley inspect delegates until a non-delegating ldap context is found.
 Control[] getRequestControls()
           
 Control[] getResponseControls()
           
 int hashCode()
           
 LdapContext newInstance(Control[] requestControls)
           
 void reconnect(Control[] connCtls)
           
 void setRequestControls(Control[] requestControls)
           
 String toString()
           
 
Methods inherited from class org.springframework.ldap.pool.DelegatingDirContext
bind, bind, createSubcontext, createSubcontext, getAttributes, getAttributes, getAttributes, getAttributes, getDelegateContext, getInnermostDelegateDirContext, getSchema, getSchema, getSchemaClassDefinition, getSchemaClassDefinition, getTargetContext, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, search, search, search, search, search, search, search, search
 
Methods inherited from class org.springframework.ldap.pool.DelegatingContext
addToEnvironment, bind, bind, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getEnvironment, getInnermostDelegateContext, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.naming.directory.DirContext
bind, bind, createSubcontext, createSubcontext, getAttributes, getAttributes, getAttributes, getAttributes, getSchema, getSchema, getSchemaClassDefinition, getSchemaClassDefinition, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, search, search, search, search, search, search, search, search
 
Methods inherited from interface javax.naming.Context
addToEnvironment, bind, bind, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 

Constructor Detail

DelegatingLdapContext

public DelegatingLdapContext(KeyedObjectPool keyedObjectPool,
                             LdapContext delegateLdapContext,
                             DirContextType dirContextType)
Create a new delegating ldap context for the specified pool, context and context type.

Parameters:
keyedObjectPool - The pool the delegate context was checked out from.
delegateLdapContext - The ldap context to delegate operations to.
dirContextType - The type of context, used as a key for the pool.
Throws:
IllegalArgumentException - if any of the arguments are null
Method Detail

getDelegateLdapContext

public LdapContext getDelegateLdapContext()
Returns:
The direct delegate for this ldap context proxy

getDelegateDirContext

public DirContext getDelegateDirContext()
Overrides:
getDelegateDirContext in class DelegatingDirContext
Returns:
The direct delegate for this dir context proxy

getInnermostDelegateLdapContext

public LdapContext getInnermostDelegateLdapContext()
Recursivley inspect delegates until a non-delegating ldap context is found.

Returns:
The innermost (real) DirContext that is being delegated to.

assertOpen

protected void assertOpen()
                   throws NamingException
Overrides:
assertOpen in class DelegatingDirContext
Throws:
NamingException - If the delegate is null, DelegatingContext.close() has been called.

equals

public boolean equals(Object obj)
Overrides:
equals in class DelegatingDirContext
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class DelegatingDirContext
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class DelegatingDirContext
See Also:
Object.toString()

extendedOperation

public ExtendedResponse extendedOperation(ExtendedRequest request)
                                   throws NamingException
Specified by:
extendedOperation in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.extendedOperation(javax.naming.ldap.ExtendedRequest)

getConnectControls

public Control[] getConnectControls()
                             throws NamingException
Specified by:
getConnectControls in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.getConnectControls()

getRequestControls

public Control[] getRequestControls()
                             throws NamingException
Specified by:
getRequestControls in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.getRequestControls()

getResponseControls

public Control[] getResponseControls()
                              throws NamingException
Specified by:
getResponseControls in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.getResponseControls()

newInstance

public LdapContext newInstance(Control[] requestControls)
                        throws NamingException
Specified by:
newInstance in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.newInstance(javax.naming.ldap.Control[])

reconnect

public void reconnect(Control[] connCtls)
               throws NamingException
Specified by:
reconnect in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.reconnect(javax.naming.ldap.Control[])

setRequestControls

public void setRequestControls(Control[] requestControls)
                        throws NamingException
Specified by:
setRequestControls in interface LdapContext
Throws:
NamingException
See Also:
LdapContext.setRequestControls(javax.naming.ldap.Control[])

close

public void close()
           throws NamingException
Specified by:
close in interface Context
Overrides:
close in class DelegatingDirContext
Throws:
NamingException
See Also:
DelegatingDirContext.close()

Spring LDAP