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 typeTransactionAwareDirContextInvocationHandler.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description TransactionAwareContextSourceProxy(ContextSource target)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.naming.directory.DirContextgetContext(java.lang.String principal, java.lang.String credentials)Gets aDirContextinstance authenticated using the supplied principal and credentials.javax.naming.directory.DirContextgetReadOnlyContext()Gets a read-onlyDirContext.javax.naming.directory.DirContextgetReadWriteContext()Gets a read-writeDirContextinstance.ContextSourcegetTarget()Get the target ContextSource.-
Methods inherited from class org.springframework.ldap.core.support.DelegatingBaseLdapPathContextSourceSupport
getBaseLdapName, getBaseLdapPath, getBaseLdapPathAsString
-
-
-
-
Constructor Detail
-
TransactionAwareContextSourceProxy
public TransactionAwareContextSourceProxy(ContextSource target)
Constructor.- Parameters:
target- the target ContextSource.
-
-
Method Detail
-
getTarget
public ContextSource getTarget()
Description copied from class:DelegatingBaseLdapPathContextSourceSupportGet the target ContextSource.- Specified by:
getTargetin classDelegatingBaseLdapPathContextSourceSupport- Returns:
- the target ContextSource.
-
getReadOnlyContext
public javax.naming.directory.DirContext getReadOnlyContext()
Description copied from interface:ContextSourceGets a read-onlyDirContext. The returnedDirContextmust be possible to perform read-only operations on.- Specified by:
getReadOnlyContextin interfaceContextSource- Returns:
- A DirContext instance, never null.
-
getReadWriteContext
public javax.naming.directory.DirContext getReadWriteContext()
Description copied from interface:ContextSourceGets a read-writeDirContextinstance.- Specified by:
getReadWriteContextin interfaceContextSource- Returns:
- A
DirContextinstance, nevernull.
-
getContext
public javax.naming.directory.DirContext getContext(java.lang.String principal, java.lang.String credentials)Description copied from interface:ContextSourceGets aDirContextinstance 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:
getContextin 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
DirContextinstance, nevernull.
-
-