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_PREFIXES
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionDelegatingDirContext
(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 void
void
bind
(String name, Object obj, Attributes attrs) void
bind
(Name name, Object obj, Attributes attrs) void
close()
createSubcontext
(String name, Attributes attrs) createSubcontext
(Name name, Attributes attrs) boolean
getAttributes
(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 targetDirContext
of the proxy.int
hashCode()
void
modifyAttributes
(String name, int modOp, Attributes attrs) void
modifyAttributes
(String name, ModificationItem[] mods) void
modifyAttributes
(Name name, int modOp, Attributes attrs) void
modifyAttributes
(Name name, ModificationItem[] mods) void
rebind
(String name, Object obj, Attributes attrs) void
rebind
(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, 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 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:
getDelegateContext
in 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:
assertOpen
in classDelegatingContext
- Throws:
NamingException
- If the delegate is null,DelegatingContext.close()
has been called.
-
equals
- Overrides:
equals
in classDelegatingContext
- See Also:
-
hashCode
public int hashCode()- Overrides:
hashCode
in classDelegatingContext
- See Also:
-
toString
- Overrides:
toString
in classDelegatingContext
- See Also:
-
getTargetContext
Description copied from interface:DirContextProxy
Get the targetDirContext
of the proxy.- Specified by:
getTargetContext
in interfaceDirContextProxy
- Returns:
- the target
DirContext
.
-
bind
- Specified by:
bind
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
bind
- Specified by:
bind
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
createSubcontext
- Specified by:
createSubcontext
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
createSubcontext
- Specified by:
createSubcontext
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getSchema
- Specified by:
getSchema
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getSchema
- Specified by:
getSchema
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinition
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinition
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
rebind
- Specified by:
rebind
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
rebind
- Specified by:
rebind
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
search
public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
- See Also:
-
close
- Specified by:
close
in interfaceContext
- Overrides:
close
in classDelegatingContext
- Throws:
NamingException
- See Also:
-