Package org.springframework.ldap.pool2
Class DelegatingDirContext
java.lang.Object
org.springframework.ldap.pool2.DelegatingContext
org.springframework.ldap.pool2.DelegatingDirContext
- All Implemented Interfaces:
Context,DirContext,DirContextProxy
- Direct Known Subclasses:
DelegatingLdapContext
Used by
PooledContextSource 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()- Since:
- 2.0
-
Field Summary
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_PREFIXESFields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionDelegatingDirContext(org.apache.commons.pool2.KeyedObjectPool<Object, Object> keyedObjectPool, DirContext delegateDirContext, DirContextType dirContextType) Create a new delegating dir context for the specified pool, context and context type. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidbind(String name, Object obj, Attributes attrs) voidbind(Name name, Object obj, Attributes attrs) voidclose()createSubcontext(String name, Attributes attrs) createSubcontext(Name name, Attributes attrs) booleangetAttributes(String name) getAttributes(String name, String[] attrIds) getAttributes(Name name) getAttributes(Name name, String[] attrIds) Recursivley inspect delegates until a non-delegating dir context is found.getSchemaClassDefinition(Name name) Get the targetDirContextof the proxy.inthashCode()voidmodifyAttributes(String name, int modOp, Attributes attrs) voidmodifyAttributes(String name, ModificationItem[] mods) voidmodifyAttributes(Name name, int modOp, Attributes attrs) voidmodifyAttributes(Name name, ModificationItem[] mods) voidrebind(String name, Object obj, Attributes attrs) voidrebind(Name name, Object obj, Attributes attrs) search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) search(String name, String filter, SearchControls cons) search(String name, Attributes matchingAttributes) search(String name, Attributes matchingAttributes, String[] attributesToReturn) search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) search(Name name, String filter, SearchControls cons) search(Name name, Attributes matchingAttributes) search(Name name, Attributes matchingAttributes, String[] attributesToReturn) toString()Methods inherited from class org.springframework.ldap.pool2.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, unbindMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 Details
-
DelegatingDirContext
public DelegatingDirContext(org.apache.commons.pool2.KeyedObjectPool<Object, Object> 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 Details
-
getDelegateDirContext
- Returns:
- The direct delegate for this dir context proxy
-
getDelegateContext
- Overrides:
getDelegateContextin classDelegatingContext- Returns:
- The direct delegate for this context proxy
-
getInnermostDelegateDirContext
Recursivley inspect delegates until a non-delegating dir context is found.- Returns:
- The innermost (real) DirContext that is being delegated to.
-
assertOpen
- Overrides:
assertOpenin classDelegatingContext- Throws:
NamingException- If the delegate is null,DelegatingContext.close()has been called.
-
equals
- Overrides:
equalsin classDelegatingContext- See Also:
-
hashCode
public int hashCode()- Overrides:
hashCodein classDelegatingContext- See Also:
-
toString
- Overrides:
toStringin classDelegatingContext- See Also:
-
getTargetContext
Description copied from interface:DirContextProxyGet the targetDirContextof the proxy.- Specified by:
getTargetContextin interfaceDirContextProxy- Returns:
- the target
DirContext.
-
bind
- Specified by:
bindin interfaceDirContext- Throws:
NamingException- See Also:
-
bind
- Specified by:
bindin interfaceDirContext- Throws:
NamingException- See Also:
-
createSubcontext
- Specified by:
createSubcontextin interfaceDirContext- Throws:
NamingException- See Also:
-
createSubcontext
- Specified by:
createSubcontextin interfaceDirContext- Throws:
NamingException- See Also:
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
getSchema
- Specified by:
getSchemain interfaceDirContext- Throws:
NamingException- See Also:
-
getSchema
- Specified by:
getSchemain interfaceDirContext- Throws:
NamingException- See Also:
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinitionin interfaceDirContext- Throws:
NamingException- See Also:
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinitionin interfaceDirContext- Throws:
NamingException- See Also:
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException- See Also:
-
rebind
- Specified by:
rebindin interfaceDirContext- Throws:
NamingException- See Also:
-
rebind
- Specified by:
rebindin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException- See Also:
-
close
- Specified by:
closein interfaceContext- Overrides:
closein classDelegatingContext- Throws:
NamingException- See Also:
-