Class TransactionAwareContextSourceProxy
java.lang.Object
org.springframework.ldap.core.support.DelegatingBaseLdapPathContextSourceSupport
org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy
- All Implemented Interfaces:
ContextSource
,BaseLdapPathSource
public class TransactionAwareContextSourceProxy
extends DelegatingBaseLdapPathContextSourceSupport
implements ContextSource
A proxy for ContextSource to make sure that the returned DirContext objects are aware
of the surrounding transactions. This makes sure that the DirContext is not closed
during the transaction and that all modifying operations are recorded, keeping track of
the corresponding rollback operations. All returned DirContext instances will be of the
type
TransactionAwareDirContextInvocationHandler
.- Since:
- 1.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetContext
(String principal, String credentials) Gets aDirContext
instance authenticated using the supplied principal and credentials.Gets a read-onlyDirContext
.Gets a read-writeDirContext
instance.Get the target ContextSource.Methods inherited from class org.springframework.ldap.core.support.DelegatingBaseLdapPathContextSourceSupport
getBaseLdapName, getBaseLdapPath, getBaseLdapPathAsString
-
Constructor Details
-
TransactionAwareContextSourceProxy
Constructor.- Parameters:
target
- the target ContextSource.
-
-
Method Details
-
getTarget
Description copied from class:DelegatingBaseLdapPathContextSourceSupport
Get the target ContextSource.- Specified by:
getTarget
in classDelegatingBaseLdapPathContextSourceSupport
- Returns:
- the target ContextSource.
-
getReadOnlyContext
Description copied from interface:ContextSource
Gets a read-onlyDirContext
. The returnedDirContext
must be possible to perform read-only operations on.- Specified by:
getReadOnlyContext
in interfaceContextSource
- Returns:
- A DirContext instance, never null.
-
getReadWriteContext
Description copied from interface:ContextSource
Gets a read-writeDirContext
instance.- Specified by:
getReadWriteContext
in interfaceContextSource
- Returns:
- A
DirContext
instance, nevernull
.
-
getContext
Description copied from interface:ContextSource
Gets aDirContext
instance authenticated using the supplied principal and credentials. Typically to be used for plain authentication purposes. Note that this method will never make use of native Java LDAP pooling, even though this instance is configured to do so. This is to force password changes in the target directory to take effect as soon as possible.- Specified by:
getContext
in interfaceContextSource
- Parameters:
principal
- The principal (typically a distinguished name of a user in the LDAP tree) to use for authentication.credentials
- The credentials to use for authentication.- Returns:
- an authenticated
DirContext
instance, nevernull
.
-