Align Visibility Modifiers in Core

Closes gh-750
This commit is contained in:
Josh Cummings
2023-05-09 13:37:27 -06:00
parent cc2560ef19
commit e854fafcfe
25 changed files with 119 additions and 72 deletions

View File

@@ -411,11 +411,9 @@ public class ContextSourceParser implements BeanDefinitionParser {
static class UrlsFactory {
// CHECKSTYLE:OFF
public static String[] urls(String value) {
static String[] urls(String value) {
return StringUtils.commaDelimitedListToStringArray(value);
}
// CHECKSTYLE:ON
}

View File

@@ -494,6 +494,7 @@ class DefaultLdapClient implements LdapClient {
return query((builder) -> builder.base(name).searchScope(SearchScope.OBJECT));
}
@Override
public SearchSpec query(Consumer<LdapQueryBuilder> consumer) {
LdapQueryBuilder builder = LdapQueryBuilder.fromQuery(this.query);
consumer.accept(builder);
@@ -585,6 +586,7 @@ class DefaultLdapClient implements LdapClient {
this.name = name;
}
@Override
public BindSpec object(Object obj) {
if (obj instanceof DirContextOperations) {
boolean updateMode = ((DirContextOperations) obj).isUpdateMode();
@@ -594,6 +596,7 @@ class DefaultLdapClient implements LdapClient {
return this;
}
@Override
public BindSpec attributes(Attributes attributes) {
this.attributes = attributes;
return this;

View File

@@ -308,6 +308,7 @@ public class DistinguishedName implements Name {
* <code>DistinguishedName</code>.
* @see #SPACED_DN_FORMAT_PROPERTY
*/
@Override
public String toString() {
String spacedFormatting = System.getProperty(SPACED_DN_FORMAT_PROPERTY);
if (!StringUtils.hasText(spacedFormatting)) {
@@ -521,6 +522,7 @@ public class DistinguishedName implements Name {
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
// A subclass with identical values should NOT be considered equal.
// EqualsBuilder in commons-lang cannot handle subclasses correctly.
@@ -537,6 +539,7 @@ public class DistinguishedName implements Name {
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return this.getClass().hashCode() ^ getNames().hashCode();
}
@@ -548,6 +551,7 @@ public class DistinguishedName implements Name {
*
* @see javax.naming.Name#compareTo(java.lang.Object)
*/
@Override
public int compareTo(Object obj) {
DistinguishedName that = (DistinguishedName) obj;
ListComparator comparator = new ListComparator();

View File

@@ -28,12 +28,12 @@ public interface DnParser {
* Parse a full Distinguished Name.
* @return the <code>DistinguishedName</code> corresponding to the parsed stream.
*/
public DistinguishedName dn() throws ParseException;
DistinguishedName dn() throws ParseException;
/**
* Parse a Relative Distinguished Name.
* @return the next rdn on the stream.
*/
public LdapRdn rdn() throws ParseException;
LdapRdn rdn() throws ParseException;
}

View File

@@ -708,7 +708,7 @@ public interface LdapOperations {
* <code>NameNotFoundException</code> will be ignored. Instead this is interpreted
* that no entries were found.
*/
void listBindings(final String base, NameClassPairCallbackHandler handler) throws NamingException;
void listBindings(String base, NameClassPairCallbackHandler handler) throws NamingException;
/**
* Perform a non-recursive listing of the children of the given <code>base</code>.
@@ -721,7 +721,7 @@ public interface LdapOperations {
* <code>NameNotFoundException</code> will be ignored. Instead this is interpreted
* that no entries were found.
*/
void listBindings(final Name base, NameClassPairCallbackHandler handler) throws NamingException;
void listBindings(Name base, NameClassPairCallbackHandler handler) throws NamingException;
/**
* Perform a non-recursive listing of the children of the given <code>base</code>.
@@ -762,7 +762,7 @@ public interface LdapOperations {
* <code>NameNotFoundException</code> will be ignored. Instead this is interpreted
* that no entries were found.
*/
List<String> listBindings(final String base) throws NamingException;
List<String> listBindings(String base) throws NamingException;
/**
* Perform a non-recursive listing of children of the given <code>base</code>.
@@ -773,7 +773,7 @@ public interface LdapOperations {
* <code>NameNotFoundException</code> will be ignored. Instead this is interpreted
* that no entries were found.
*/
List<String> listBindings(final Name base) throws NamingException;
List<String> listBindings(Name base) throws NamingException;
/**
* Perform a non-recursive listing of the children of the given <code>base</code>. The
@@ -1036,7 +1036,7 @@ public interface LdapOperations {
* @throws ContextNotEmptyException if newDn is already bound
* @throws NamingException if any other error occurs.
*/
void rename(final Name oldDn, final Name newDn) throws NamingException;
void rename(Name oldDn, Name newDn) throws NamingException;
/**
* Move an entry in the LDAP tree to a new location.
@@ -1047,7 +1047,7 @@ public interface LdapOperations {
* @throws ContextNotEmptyException if newDn is already bound
* @throws NamingException if any other error occurs.
*/
void rename(final String oldDn, final String newDn) throws NamingException;
void rename(String oldDn, String newDn) throws NamingException;
/**
* Convenience method to lookup the supplied DN and automatically cast it to

View File

@@ -154,6 +154,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return getLdapEncoded();
}
@@ -186,6 +187,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return this.key.toUpperCase().hashCode() ^ this.value.toUpperCase().hashCode();
}
@@ -195,6 +197,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
// Slightly more lenient equals comparison here to enable immutable
// instances to equal mutable ones.
@@ -216,6 +219,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
* @throws ClassCastException if the object is not possible to cast to an
* LdapRdnComponent.
*/
@Override
public int compareTo(Object obj) {
LdapRdnComponent that = (LdapRdnComponent) obj;
@@ -244,14 +248,16 @@ public class LdapRdnComponent implements Comparable, Serializable {
private static final long serialVersionUID = -7099970046426346567L;
public ImmutableLdapRdnComponent(String key, String value) {
ImmutableLdapRdnComponent(String key, String value) {
super(key, value);
}
@Override
public void setKey(String key) {
throw new UnsupportedOperationException("SetValue not supported for this immutable LdapRdnComponent");
}
@Override
public void setValue(String value) {
throw new UnsupportedOperationException("SetKey not supported for this immutable LdapRdnComponent");
}

View File

@@ -1903,6 +1903,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
private static final class NullAuthenticatedLdapEntryContextCallback
implements AuthenticatedLdapEntryContextCallback, AuthenticatedLdapEntryContextMapper<Object> {
@Override
public void executeWithContext(DirContext ctx, LdapEntryIdentification ldapEntryIdentification) {
// Do nothing
}
@@ -1922,10 +1923,12 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
*/
public static final class NullDirContextProcessor implements DirContextProcessor {
@Override
public void postProcess(DirContext ctx) {
// Do nothing
}
@Override
public void preProcess(DirContext ctx) {
// Do nothing
}
@@ -1938,7 +1941,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
*
* @author Mattias Hellborg Arthursson
*/
public final static class MappingCollectingNameClassPairCallbackHandler<T>
public static final class MappingCollectingNameClassPairCallbackHandler<T>
extends CollectingNameClassPairCallbackHandler<T> {
private NameClassPairMapper<T> mapper;
@@ -1950,6 +1953,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
/**
* {@inheritDoc}
*/
@Override
public T getObjectFromNameClassPair(NameClassPair nameClassPair) {
try {
return this.mapper.mapFromNameClassPair(nameClassPair);
@@ -1963,6 +1967,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
private static final class NullAuthenticationErrorCallback implements AuthenticationErrorCallback {
@Override
public void execute(Exception ex) {
// Do nothing
}

View File

@@ -37,6 +37,7 @@ public abstract class AbstractContextMapper<T> implements ContextMapper<T> {
* is used, causing the objects passed in be anything else than
* {@link DirContextOperations} instances.
*/
@Override
public final T mapFromContext(Object ctx) {
return doMapFromContext((DirContextOperations) ctx);
}

View File

@@ -666,10 +666,12 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource
class SimpleAuthenticationSource implements AuthenticationSource {
@Override
public String getPrincipal() {
return AbstractContextSource.this.userDn;
}
@Override
public String getCredentials() {
return AbstractContextSource.this.password;
}

View File

@@ -183,15 +183,17 @@ public abstract class AbstractTlsDirContextAuthenticationStrategy implements Dir
private final StartTlsResponse tlsResponse;
public TlsAwareDirContextProxy(LdapContext target, StartTlsResponse tlsResponse) {
TlsAwareDirContextProxy(LdapContext target, StartTlsResponse tlsResponse) {
this.target = target;
this.tlsResponse = tlsResponse;
}
@Override
public DirContext getTargetContext() {
return this.target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals(CLOSE_METHOD_NAME)) {
this.tlsResponse.close();

View File

@@ -35,6 +35,6 @@ import org.springframework.ldap.core.ContextMapper;
*/
public interface ContextMapperWithControls<T> extends ContextMapper<T> {
T mapFromContextWithControls(final Object ctx, final HasControls hasControls) throws NamingException;
T mapFromContextWithControls(Object ctx, HasControls hasControls) throws NamingException;
}

View File

@@ -79,7 +79,7 @@ import org.springframework.ldap.support.LdapUtils;
public class DefaultIncrementalAttributesMapper
implements IncrementalAttributesMapper<DefaultIncrementalAttributesMapper> {
private final static Logger LOG = LoggerFactory.getLogger(DefaultIncrementalAttributesMapper.class);
private static final Logger LOG = LoggerFactory.getLogger(DefaultIncrementalAttributesMapper.class);
private Map<String, IncrementalAttributeState> stateMap = new LinkedHashMap<String, IncrementalAttributeState>();

View File

@@ -40,11 +40,11 @@ class RangeOption implements Comparable<RangeOption> {
private static final Pattern RANGE_PATTERN = Pattern.compile("^Range=([0-9]+)(-([0-9]+|\\*))?$",
Pattern.CASE_INSENSITIVE);
public RangeOption(int initial) {
RangeOption(int initial) {
this(initial, TERMINAL_END_OF_RANGE);
}
public RangeOption(int initial, int terminal) {
RangeOption(int initial, int terminal) {
if (terminal < 0 && (terminal != TERMINAL_END_OF_RANGE && terminal != TERMINAL_MISSING)) {
throw new IllegalArgumentException("Illegal range-terminal: " + terminal);
}
@@ -62,26 +62,27 @@ class RangeOption implements Comparable<RangeOption> {
this.terminal = terminal;
}
public boolean isTerminalEndOfRange() {
boolean isTerminalEndOfRange() {
return this.terminal == TERMINAL_END_OF_RANGE;
}
public boolean isTerminalMissing() {
boolean isTerminalMissing() {
return this.terminal == TERMINAL_MISSING;
}
public int getInitial() {
int getInitial() {
return this.initial;
}
public int getTerminal() {
int getTerminal() {
return this.terminal;
}
public boolean isFullRange() {
boolean isFullRange() {
return getInitial() == 0 && getTerminal() == TERMINAL_END_OF_RANGE;
}
@Override
public String toString() {
StringBuilder rangeBuilder = new StringBuilder();
appendTo(rangeBuilder);
@@ -89,7 +90,7 @@ class RangeOption implements Comparable<RangeOption> {
return rangeBuilder.toString();
}
public void appendTo(StringBuilder rangeBuilder) {
void appendTo(StringBuilder rangeBuilder) {
rangeBuilder.append("Range=").append(this.initial);
if (!isTerminalMissing()) {
@@ -104,7 +105,7 @@ class RangeOption implements Comparable<RangeOption> {
}
}
public static RangeOption parse(String option) {
static RangeOption parse(String option) {
Matcher rangeMatcher = RANGE_PATTERN.matcher(option);
rangeMatcher.find();
@@ -132,6 +133,7 @@ class RangeOption implements Comparable<RangeOption> {
return new RangeOption(initial, terminal);
}
@Override
public int compareTo(RangeOption that) {
if (this.getInitial() != that.getInitial()) {
throw new IllegalStateException("Ranges cannot be compared, range-initial not the same: " + this.toString()
@@ -189,7 +191,7 @@ class RangeOption implements Comparable<RangeOption> {
return result;
}
public RangeOption nextRange(int pageSize) {
RangeOption nextRange(int pageSize) {
if (getTerminal() < 0) {
throw new IllegalStateException("Cannot generate next range, range-terminal: " + getTerminal());
}

View File

@@ -199,7 +199,7 @@ import org.springframework.ldap.odm.annotations.Transient;
}
@SuppressWarnings("unchecked")
public Collection<Object> newCollectionInstance() {
Collection<Object> newCollectionInstance() {
try {
return (Collection<Object>) this.collectionClass.newInstance();
}
@@ -227,7 +227,7 @@ import org.springframework.ldap.odm.annotations.Transient;
}
// Extract meta-data from the given field
public AttributeMetaData(Field field) {
AttributeMetaData(Field field) {
this.field = field;
this.dnAttribute = field.getAnnotation(DnAttribute.class);
@@ -267,59 +267,59 @@ import org.springframework.ldap.odm.annotations.Transient;
}
}
public String getSyntax() {
String getSyntax() {
return this.syntax;
}
public boolean isBinary() {
boolean isBinary() {
return this.isBinary;
}
public Field getField() {
Field getField() {
return this.field;
}
public CaseIgnoreString getName() {
CaseIgnoreString getName() {
return this.name;
}
public boolean isCollection() {
boolean isCollection() {
return this.isCollection;
}
public boolean isId() {
boolean isId() {
return this.isId;
}
public boolean isReadOnly() {
boolean isReadOnly() {
return this.isReadOnly;
}
public boolean isTransient() {
boolean isTransient() {
return this.isTransient;
}
public DnAttribute getDnAttribute() {
DnAttribute getDnAttribute() {
return this.dnAttribute;
}
public boolean isDnAttribute() {
boolean isDnAttribute() {
return this.dnAttribute != null;
}
public boolean isObjectClass() {
boolean isObjectClass() {
return this.isObjectClass;
}
public Class<?> getValueClass() {
Class<?> getValueClass() {
return this.valueClass;
}
public String[] getAttributes() {
String[] getAttributes() {
return this.attributes;
}
public Class<?> getJndiClass() {
Class<?> getJndiClass() {
if (isBinary()) {
return byte[].class;
}

View File

@@ -25,25 +25,29 @@ import org.springframework.util.Assert;
private final int hashCode;
public CaseIgnoreString(String string) {
CaseIgnoreString(String string) {
Assert.notNull(string, "string must not be null");
this.string = string;
this.hashCode = string.toUpperCase().hashCode();
}
@Override
public boolean equals(Object other) {
return other instanceof CaseIgnoreString && ((CaseIgnoreString) other).string.equalsIgnoreCase(this.string);
}
@Override
public int hashCode() {
return this.hashCode;
}
@Override
public int compareTo(CaseIgnoreString other) {
CaseIgnoreString cis = other;
return String.CASE_INSENSITIVE_ORDER.compare(this.string, cis.string);
}
@Override
public String toString() {
return this.string;
}

View File

@@ -67,11 +67,11 @@ import org.springframework.util.StringUtils;
private Name base = LdapUtils.emptyLdapName();
public Set<CaseIgnoreString> getObjectClasses() {
Set<CaseIgnoreString> getObjectClasses() {
return this.objectClasses;
}
public AttributeMetaData getIdAttribute() {
AttributeMetaData getIdAttribute() {
return this.idAttribute;
}
@@ -80,15 +80,16 @@ import org.springframework.util.StringUtils;
*
* @see java.lang.Iterable#iterator()
*/
@Override
public Iterator<Field> iterator() {
return this.fieldToAttribute.keySet().iterator();
}
public AttributeMetaData getAttribute(Field field) {
AttributeMetaData getAttribute(Field field) {
return this.fieldToAttribute.get(field);
}
public ObjectMetaData(Class<?> clazz) {
ObjectMetaData(Class<?> clazz) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Extracting metadata from %1$s", clazz));
}
@@ -195,7 +196,7 @@ import org.springframework.util.StringUtils;
return this.dnAttributes.size() > 0 && this.indexedDnAttributes;
}
public Set<AttributeMetaData> getDnAttributes() {
Set<AttributeMetaData> getDnAttributes() {
return this.dnAttributes;
}

View File

@@ -70,7 +70,7 @@ public class ConversionServiceConverterManager implements ConverterManager {
return this.conversionService.convert(source, toClass);
}
public final static class NameToStringConverter
public static final class NameToStringConverter
implements org.springframework.core.convert.converter.Converter<Name, String> {
@Override

View File

@@ -25,7 +25,7 @@ public enum PoolExhaustedAction {
private final byte value;
private PoolExhaustedAction(byte value) {
PoolExhaustedAction(byte value) {
this.value = value;
}

View File

@@ -101,14 +101,14 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
/**
* @return the contextSource
*/
public ContextSource getContextSource() {
ContextSource getContextSource() {
return this.contextSource;
}
/**
* @param contextSource the contextSource to set
*/
public void setContextSource(ContextSource contextSource) {
void setContextSource(ContextSource contextSource) {
if (contextSource == null) {
throw new IllegalArgumentException("contextSource may not be null");
}
@@ -119,14 +119,14 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
/**
* @return the dirContextValidator
*/
public DirContextValidator getDirContextValidator() {
DirContextValidator getDirContextValidator() {
return this.dirContextValidator;
}
/**
* @param dirContextValidator the dirContextValidator to set
*/
public void setDirContextValidator(DirContextValidator dirContextValidator) {
void setDirContextValidator(DirContextValidator dirContextValidator) {
if (dirContextValidator == null) {
throw new IllegalArgumentException("dirContextValidator may not be null");
}
@@ -137,6 +137,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
/**
* @see org.apache.commons.pool.BaseKeyedPoolableObjectFactory#makeObject(java.lang.Object)
*/
@Override
public Object makeObject(Object key) throws Exception {
Assert.notNull(this.contextSource, "ContextSource may not be null");
Assert.isTrue(key instanceof DirContextType, "key must be a DirContextType");
@@ -181,6 +182,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
* @see org.apache.commons.pool.BaseKeyedPoolableObjectFactory#validateObject(java.lang.Object,
* java.lang.Object)
*/
@Override
public boolean validateObject(Object key, Object obj) {
Assert.notNull(this.dirContextValidator, "DirContextValidator may not be null");
Assert.isTrue(key instanceof DirContextType, "key must be a DirContextType");
@@ -201,6 +203,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
* @see org.apache.commons.pool.BaseKeyedPoolableObjectFactory#destroyObject(java.lang.Object,
* java.lang.Object)
*/
@Override
public void destroyObject(Object key, Object obj) throws Exception {
Assert.isTrue(obj instanceof DirContext, "The Object to validate must be of type '" + DirContext.class + "'");
@@ -232,7 +235,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
private boolean hasFailed = false;
public FailureAwareContextProxy(DirContext target) {
FailureAwareContextProxy(DirContext target) {
Assert.notNull(target, "Target must not be null");
this.target = target;
}
@@ -241,6 +244,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
* @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
* java.lang.reflect.Method, java.lang.Object[])
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();

View File

@@ -106,14 +106,14 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
/**
* @return the contextSource
*/
public ContextSource getContextSource() {
ContextSource getContextSource() {
return this.contextSource;
}
/**
* @param contextSource the contextSource to set
*/
public void setContextSource(ContextSource contextSource) {
void setContextSource(ContextSource contextSource) {
if (contextSource == null) {
throw new IllegalArgumentException("contextSource may not be null");
}
@@ -124,14 +124,14 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
/**
* @return the dirContextValidator
*/
public DirContextValidator getDirContextValidator() {
DirContextValidator getDirContextValidator() {
return this.dirContextValidator;
}
/**
* @param dirContextValidator the dirContextValidator to set
*/
public void setDirContextValidator(DirContextValidator dirContextValidator) {
void setDirContextValidator(DirContextValidator dirContextValidator) {
if (dirContextValidator == null) {
throw new IllegalArgumentException("dirContextValidator may not be null");
}
@@ -255,7 +255,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
private boolean hasFailed = false;
public FailureAwareContextProxy(DirContext target) {
FailureAwareContextProxy(DirContext target) {
Assert.notNull(target, "Target must not be null");
this.target = target;
}
@@ -264,6 +264,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
* @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
* java.lang.reflect.Method, java.lang.Object[])
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();

View File

@@ -41,7 +41,7 @@ public enum SearchScope {
private final int id;
private SearchScope(int id) {
SearchScope(int id) {
this.id = id;
}

View File

@@ -188,7 +188,7 @@ public final class LdapEncoder {
* @return The decoded value as a string.
* @throws BadLdapGrammarException
*/
static public String nameDecode(String value) throws BadLdapGrammarException {
public static String nameDecode(String value) throws BadLdapGrammarException {
if (value == null) {
return null;

View File

@@ -772,7 +772,7 @@ public final class LdapUtils {
private final Class<T> clazz;
public CollectingAttributeValueCallbackHandler(Collection<T> collection, Class<T> clazz) {
CollectingAttributeValueCallbackHandler(Collection<T> collection, Class<T> clazz) {
Assert.notNull(collection, "Collection must not be null");
Assert.notNull(clazz, "Clazz parameter must not be null");
@@ -780,6 +780,7 @@ public final class LdapUtils {
this.clazz = clazz;
}
@Override
public void handleAttributeValue(String attributeName, Object attributeValue, int index) {
Assert.isTrue(attributeName == null || this.clazz.isAssignableFrom(attributeValue.getClass()));
this.collection.add(this.clazz.cast(attributeValue));

View File

@@ -54,6 +54,7 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager#
* isExistingTransaction(java.lang.Object)
*/
@Override
protected boolean isExistingTransaction(Object transaction) {
// We don't support nested transactions here
return false;
@@ -63,6 +64,7 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
* @see
* org.springframework.jdbc.datasource.DataSourceTransactionManager#doGetTransaction()
*/
@Override
protected Object doGetTransaction() {
Object dataSourceTransactionObject = super.doGetTransaction();
Object contextSourceTransactionObject = this.ldapManagerDelegate.doGetTransaction();
@@ -76,6 +78,7 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
* org.springframework.jdbc.datasource.DataSourceTransactionManager#doBegin(java.lang.
* Object, org.springframework.transaction.TransactionDefinition)
*/
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
ContextSourceAndDataSourceTransactionObject actualTransactionObject = (ContextSourceAndDataSourceTransactionObject) transaction;
@@ -94,6 +97,7 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager#
* doCleanupAfterCompletion(java.lang.Object)
*/
@Override
protected void doCleanupAfterCompletion(Object transaction) {
ContextSourceAndDataSourceTransactionObject actualTransactionObject = (ContextSourceAndDataSourceTransactionObject) transaction;
@@ -105,6 +109,7 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager#doCommit(org.
* springframework.transaction.support.DefaultTransactionStatus)
*/
@Override
protected void doCommit(DefaultTransactionStatus status) {
ContextSourceAndDataSourceTransactionObject actualTransactionObject = (ContextSourceAndDataSourceTransactionObject) status
@@ -138,6 +143,7 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
* org.springframework.jdbc.datasource.DataSourceTransactionManager#doRollback(org.
* springframework.transaction.support.DefaultTransactionStatus)
*/
@Override
protected void doRollback(DefaultTransactionStatus status) {
ContextSourceAndDataSourceTransactionObject actualTransactionObject = (ContextSourceAndDataSourceTransactionObject) status
.getTransaction();
@@ -187,23 +193,22 @@ public class ContextSourceAndDataSourceTransactionManager extends DataSourceTran
this.ldapManagerDelegate.checkRenamingStrategy();
}
private final static class ContextSourceAndDataSourceTransactionObject {
private static final class ContextSourceAndDataSourceTransactionObject {
private Object ldapTransactionObject;
private Object dataSourceTransactionObject;
public ContextSourceAndDataSourceTransactionObject(Object ldapTransactionObject,
Object dataSourceTransactionObject) {
ContextSourceAndDataSourceTransactionObject(Object ldapTransactionObject, Object dataSourceTransactionObject) {
this.ldapTransactionObject = ldapTransactionObject;
this.dataSourceTransactionObject = dataSourceTransactionObject;
}
public Object getDataSourceTransactionObject() {
Object getDataSourceTransactionObject() {
return this.dataSourceTransactionObject;
}
public Object getLdapTransactionObject() {
Object getLdapTransactionObject() {
return this.ldapTransactionObject;
}

View File

@@ -54,6 +54,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* @see org.springframework.orm.hibernate5.HibernateTransactionManager#
* isExistingTransaction(java.lang.Object)
*/
@Override
protected boolean isExistingTransaction(Object transaction) {
ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;
@@ -64,6 +65,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* @see
* org.springframework.orm.hibernate5.HibernateTransactionManager#doGetTransaction()
*/
@Override
protected Object doGetTransaction() {
Object dataSourceTransactionObject = super.doGetTransaction();
Object contextSourceTransactionObject = this.ldapManagerDelegate.doGetTransaction();
@@ -77,6 +79,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* org.springframework.orm.hibernate5.HibernateTransactionManager#doBegin(java.lang.
* Object, org.springframework.transaction.TransactionDefinition)
*/
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;
@@ -95,6 +98,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* @see org.springframework.orm.hibernate5.HibernateTransactionManager#
* doCleanupAfterCompletion(java.lang.Object)
*/
@Override
protected void doCleanupAfterCompletion(Object transaction) {
ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) transaction;
@@ -106,6 +110,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* @see org.springframework.orm.hibernate5.HibernateTransactionManager#doCommit(org.
* springframework.transaction.support.DefaultTransactionStatus)
*/
@Override
protected void doCommit(DefaultTransactionStatus status) {
ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
@@ -138,6 +143,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* @see org.springframework.orm.hibernate5.HibernateTransactionManager#doRollback(org.
* springframework.transaction.support.DefaultTransactionStatus)
*/
@Override
protected void doRollback(DefaultTransactionStatus status) {
ContextSourceAndHibernateTransactionObject actualTransactionObject = (ContextSourceAndHibernateTransactionObject) status
.getTransaction();
@@ -167,6 +173,7 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* org.springframework.orm.hibernate5.HibernateTransactionManager#doSuspend(java.lang.
* Object)
*/
@Override
protected Object doSuspend(Object transaction) {
throw new TransactionSuspensionNotSupportedException(
"Transaction manager [" + getClass().getName() + "] does not support transaction suspension");
@@ -177,11 +184,13 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
* org.springframework.orm.hibernate5.HibernateTransactionManager#doResume(java.lang.
* Object, java.lang.Object)
*/
@Override
protected void doResume(Object transaction, Object suspendedResources) {
throw new TransactionSuspensionNotSupportedException(
"Transaction manager [" + getClass().getName() + "] does not support transaction suspension");
}
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
this.ldapManagerDelegate.checkRenamingStrategy();
@@ -193,17 +202,16 @@ public class ContextSourceAndHibernateTransactionManager extends HibernateTransa
private Object hibernateTransactionObject;
public ContextSourceAndHibernateTransactionObject(Object ldapTransactionObject,
Object hibernateTransactionObject) {
ContextSourceAndHibernateTransactionObject(Object ldapTransactionObject, Object hibernateTransactionObject) {
this.ldapTransactionObject = ldapTransactionObject;
this.hibernateTransactionObject = hibernateTransactionObject;
}
public Object getHibernateTransactionObject() {
Object getHibernateTransactionObject() {
return this.hibernateTransactionObject;
}
public Object getLdapTransactionObject() {
Object getLdapTransactionObject() {
return this.ldapTransactionObject;
}