Class DelegatingDirContext
java.lang.Object
org.springframework.ldap.pool.DelegatingContext
org.springframework.ldap.pool.DelegatingDirContext
- All Implemented Interfaces:
Context, DirContext, DirContextProxy
- Direct Known Subclasses:
DelegatingLdapContext
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()-
Field Summary
Fields inherited from interface Context
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 DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionDelegatingDirContext(org.apache.commons.pool.KeyedObjectPool keyedObjectPool, DirContext delegateDirContext, DirContextType dirContextType) Create a new delegating dir context for the specified pool, context and context type. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAssert that this context is still open.voidbind(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) @Nullable ContextGet the direct delegate for this context proxy.@Nullable DirContextGet the direct delegate for this dir context proxy.@Nullable DirContextRecursivley 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 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 interface 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.pool.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 Details
-
getDelegateDirContext
Get the direct delegate for this dir context proxy.- Returns:
- The direct delegate for this dir context proxy
-
getDelegateContext
Description copied from class:DelegatingContextGet the direct delegate for this context proxy.- 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
Description copied from class:DelegatingContextAssert that this context is still open.- Overrides:
assertOpenin classDelegatingContext- Throws:
NamingException- If the delegate is null,DelegatingContext.close()has been called.
-
equals
- Overrides:
equalsin classDelegatingContext
-
hashCode
public int hashCode()- Overrides:
hashCodein classDelegatingContext
-
toString
- Overrides:
toStringin classDelegatingContext
-
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
-
bind
- Specified by:
bindin interfaceDirContext- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontextin interfaceDirContext- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontextin interfaceDirContext- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributesin interfaceDirContext- Throws:
NamingException
-
getSchema
- Specified by:
getSchemain interfaceDirContext- Throws:
NamingException
-
getSchema
- Specified by:
getSchemain interfaceDirContext- Throws:
NamingException
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinitionin interfaceDirContext- Throws:
NamingException
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinitionin interfaceDirContext- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributesin interfaceDirContext- Throws:
NamingException
-
rebind
- Specified by:
rebindin interfaceDirContext- Throws:
NamingException
-
rebind
- Specified by:
rebindin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) throws NamingException - Specified by:
searchin interfaceDirContext- Throws:
NamingException
-
close
- Specified by:
closein interfaceContext- Overrides:
closein classDelegatingContext- Throws:
NamingException
-