Removed package dependency cycle.
This commit is contained in:
@@ -14,7 +14,6 @@ import org.springframework.ldap.NamingException;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
import org.springframework.ldap.core.DirContextProxy;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
import org.springframework.ldap.transaction.compensating.LdapTransactionUtils;
|
||||
|
||||
/**
|
||||
* A {@link ContextSource} implementation using returning
|
||||
@@ -104,7 +103,7 @@ public class SingleContextSource implements ContextSource {
|
||||
private DirContext getNonClosingDirContextProxy(DirContext context) {
|
||||
return (DirContext) Proxy.newProxyInstance(DirContextProxy.class
|
||||
.getClassLoader(), new Class[] {
|
||||
LdapTransactionUtils.getActualTargetClass(context),
|
||||
LdapUtils.getActualTargetClass(context),
|
||||
DirContextProxy.class },
|
||||
new SingleContextSource.NonClosingDirContextInvocationHandler(
|
||||
context));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.ldap.support;
|
||||
|
||||
import javax.naming.directory.DirContext;
|
||||
import javax.naming.ldap.LdapContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -206,4 +207,21 @@ public final class LdapUtils {
|
||||
// fallback
|
||||
return new org.springframework.ldap.UncategorizedLdapException(ex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual class of the supplied DirContext instance; LdapContext or
|
||||
* DirContext.
|
||||
*
|
||||
* @param context
|
||||
* the DirContext instance to check.
|
||||
* @return LdapContext.class if context is an LdapContext, DirContext.class
|
||||
* otherwise.
|
||||
*/
|
||||
public static Class getActualTargetClass(DirContext context) {
|
||||
if (context instanceof LdapContext) {
|
||||
return LdapContext.class;
|
||||
}
|
||||
|
||||
return DirContext.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
package org.springframework.ldap.transaction.compensating;
|
||||
|
||||
import javax.naming.Name;
|
||||
import javax.naming.directory.DirContext;
|
||||
import javax.naming.ldap.LdapContext;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
@@ -101,21 +99,4 @@ public final class LdapTransactionUtils {
|
||||
.equals(methodName, UNBIND_METHOD_NAME));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual class of the supplied DirContext instance; LdapContext or
|
||||
* DirContext.
|
||||
*
|
||||
* @param context
|
||||
* the DirContext instance to check.
|
||||
* @return LdapContext.class if context is an LdapContext, DirContext.class
|
||||
* otherwise.
|
||||
*/
|
||||
public static Class getActualTargetClass(DirContext context) {
|
||||
if (context instanceof LdapContext) {
|
||||
return LdapContext.class;
|
||||
}
|
||||
|
||||
return DirContext.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.naming.directory.DirContext;
|
||||
import org.springframework.ldap.NamingException;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
import org.springframework.ldap.core.DirContextProxy;
|
||||
import org.springframework.ldap.transaction.compensating.LdapTransactionUtils;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ public class TransactionAwareContextSourceProxy implements ContextSource {
|
||||
return (DirContext) Proxy
|
||||
.newProxyInstance(DirContextProxy.class.getClassLoader(),
|
||||
new Class[] {
|
||||
LdapTransactionUtils
|
||||
LdapUtils
|
||||
.getActualTargetClass(context),
|
||||
DirContextProxy.class },
|
||||
new TransactionAwareDirContextInvocationHandler(
|
||||
|
||||
Reference in New Issue
Block a user