Spring LDAP Framework

org.springframework.ldap.pool
Class DelegatingDirContext

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

public class DelegatingDirContext
extends DelegatingContext
implements DirContext, DirContextProxy

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

Author:
Eric Dalquist

Field Summary
 
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
DelegatingDirContext(KeyedObjectPool keyedObjectPool, DirContext delegateDirContext, DirContextType dirContextType)
          Create a new delegating dir context for the specified pool, context and context type.
 
Method Summary
protected  void assertOpen()
           
 void bind(Name name, Object obj, Attributes attrs)
           
 void bind(String name, Object obj, Attributes attrs)
           
 void close()
           
 DirContext createSubcontext(Name name, Attributes attrs)
           
 DirContext createSubcontext(String name, Attributes attrs)
           
 boolean equals(Object obj)
           
 Attributes getAttributes(Name name)
           
 Attributes getAttributes(Name name, String[] attrIds)
           
 Attributes getAttributes(String name)
           
 Attributes getAttributes(String name, String[] attrIds)
           
 Context getDelegateContext()
           
 DirContext getDelegateDirContext()
           
 DirContext getInnermostDelegateDirContext()
          Recursivley inspect delegates until a non-delegating dir context is found.
 DirContext getSchema(Name name)
           
 DirContext getSchema(String name)
           
 DirContext getSchemaClassDefinition(Name name)
           
 DirContext getSchemaClassDefinition(String name)
           
 DirContext getTargetContext()
          Get the target DirContext of the proxy.
 int hashCode()
           
 void modifyAttributes(Name name, int mod_op, Attributes attrs)
           
 void modifyAttributes(Name name, ModificationItem[] mods)
           
 void modifyAttributes(String name, int mod_op, Attributes attrs)
           
 void modifyAttributes(String name, ModificationItem[] mods)
           
 void rebind(Name name, Object obj, Attributes attrs)
           
 void rebind(String name, Object obj, Attributes attrs)
           
 NamingEnumeration search(Name name, Attributes matchingAttributes)
           
 NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn)
           
 NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons)
           
 NamingEnumeration search(Name name, String filter, SearchControls cons)
           
 NamingEnumeration search(String name, Attributes matchingAttributes)
           
 NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn)
           
 NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons)
           
 NamingEnumeration search(String name, String filter, SearchControls cons)
           
 String toString()
           
 
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.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

DelegatingDirContext

public DelegatingDirContext(KeyedObjectPool keyedObjectPool,
                            DirContext delegateDirContext,
                            DirContextType dirContextType)
Create a new delegating dir context for the specified pool, context and context type.

Parameters:
keyedObjectPool - The pool the delegate context was checked out from.
delegateDirContext - The dir 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

getDelegateDirContext

public DirContext getDelegateDirContext()
Returns:
The direct delegate for this dir context proxy

getDelegateContext

public Context getDelegateContext()
Overrides:
getDelegateContext in class DelegatingContext
Returns:
The direct delegate for this context proxy

getInnermostDelegateDirContext

public DirContext getInnermostDelegateDirContext()
Recursivley inspect delegates until a non-delegating dir context is found.

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

assertOpen

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

equals

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

hashCode

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

toString

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

getTargetContext

public DirContext getTargetContext()
Description copied from interface: DirContextProxy
Get the target DirContext of the proxy.

Specified by:
getTargetContext in interface DirContextProxy
Returns:
the target DirContext.

bind

public void bind(Name name,
                 Object obj,
                 Attributes attrs)
          throws NamingException
Specified by:
bind in interface DirContext
Throws:
NamingException
See Also:
DirContext.bind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes)

bind

public void bind(String name,
                 Object obj,
                 Attributes attrs)
          throws NamingException
Specified by:
bind in interface DirContext
Throws:
NamingException
See Also:
DirContext.bind(java.lang.String, java.lang.Object, javax.naming.directory.Attributes)

createSubcontext

public DirContext createSubcontext(Name name,
                                   Attributes attrs)
                            throws NamingException
Specified by:
createSubcontext in interface DirContext
Throws:
NamingException
See Also:
DirContext.createSubcontext(javax.naming.Name, javax.naming.directory.Attributes)

createSubcontext

public DirContext createSubcontext(String name,
                                   Attributes attrs)
                            throws NamingException
Specified by:
createSubcontext in interface DirContext
Throws:
NamingException
See Also:
DirContext.createSubcontext(java.lang.String, javax.naming.directory.Attributes)

getAttributes

public Attributes getAttributes(Name name,
                                String[] attrIds)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.getAttributes(javax.naming.Name, java.lang.String[])

getAttributes

public Attributes getAttributes(Name name)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.getAttributes(javax.naming.Name)

getAttributes

public Attributes getAttributes(String name,
                                String[] attrIds)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.getAttributes(java.lang.String, java.lang.String[])

getAttributes

public Attributes getAttributes(String name)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.getAttributes(java.lang.String)

getSchema

public DirContext getSchema(Name name)
                     throws NamingException
Specified by:
getSchema in interface DirContext
Throws:
NamingException
See Also:
DirContext.getSchema(javax.naming.Name)

getSchema

public DirContext getSchema(String name)
                     throws NamingException
Specified by:
getSchema in interface DirContext
Throws:
NamingException
See Also:
DirContext.getSchema(java.lang.String)

getSchemaClassDefinition

public DirContext getSchemaClassDefinition(Name name)
                                    throws NamingException
Specified by:
getSchemaClassDefinition in interface DirContext
Throws:
NamingException
See Also:
DirContext.getSchemaClassDefinition(javax.naming.Name)

getSchemaClassDefinition

public DirContext getSchemaClassDefinition(String name)
                                    throws NamingException
Specified by:
getSchemaClassDefinition in interface DirContext
Throws:
NamingException
See Also:
DirContext.getSchemaClassDefinition(java.lang.String)

modifyAttributes

public void modifyAttributes(Name name,
                             int mod_op,
                             Attributes attrs)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.modifyAttributes(javax.naming.Name, int, javax.naming.directory.Attributes)

modifyAttributes

public void modifyAttributes(Name name,
                             ModificationItem[] mods)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.modifyAttributes(javax.naming.Name, javax.naming.directory.ModificationItem[])

modifyAttributes

public void modifyAttributes(String name,
                             int mod_op,
                             Attributes attrs)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.modifyAttributes(java.lang.String, int, javax.naming.directory.Attributes)

modifyAttributes

public void modifyAttributes(String name,
                             ModificationItem[] mods)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException
See Also:
DirContext.modifyAttributes(java.lang.String, javax.naming.directory.ModificationItem[])

rebind

public void rebind(Name name,
                   Object obj,
                   Attributes attrs)
            throws NamingException
Specified by:
rebind in interface DirContext
Throws:
NamingException
See Also:
DirContext.rebind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes)

rebind

public void rebind(String name,
                   Object obj,
                   Attributes attrs)
            throws NamingException
Specified by:
rebind in interface DirContext
Throws:
NamingException
See Also:
DirContext.rebind(java.lang.String, java.lang.Object, javax.naming.directory.Attributes)

search

public NamingEnumeration search(Name name,
                                Attributes matchingAttributes,
                                String[] attributesToReturn)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(javax.naming.Name, javax.naming.directory.Attributes, java.lang.String[])

search

public NamingEnumeration search(Name name,
                                Attributes matchingAttributes)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(javax.naming.Name, javax.naming.directory.Attributes)

search

public NamingEnumeration search(Name name,
                                String filterExpr,
                                Object[] filterArgs,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(javax.naming.Name, java.lang.String, java.lang.Object[], javax.naming.directory.SearchControls)

search

public NamingEnumeration search(Name name,
                                String filter,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(javax.naming.Name, java.lang.String, javax.naming.directory.SearchControls)

search

public NamingEnumeration search(String name,
                                Attributes matchingAttributes,
                                String[] attributesToReturn)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(java.lang.String, javax.naming.directory.Attributes, java.lang.String[])

search

public NamingEnumeration search(String name,
                                Attributes matchingAttributes)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(java.lang.String, javax.naming.directory.Attributes)

search

public NamingEnumeration search(String name,
                                String filterExpr,
                                Object[] filterArgs,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(java.lang.String, java.lang.String, java.lang.Object[], javax.naming.directory.SearchControls)

search

public NamingEnumeration search(String name,
                                String filter,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException
See Also:
DirContext.search(java.lang.String, java.lang.String, javax.naming.directory.SearchControls)

close

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

Spring LDAP Framework

Copyright © 2005-2010 The Spring LDAP Framework. All Rights Reserved.