Add @Override annotations to main sources

Issue: SPR-10130
This commit is contained in:
Chris Beams
2012-12-28 14:00:16 +01:00
parent 9c2046c3ee
commit 3b40ce76bf
1256 changed files with 5716 additions and 0 deletions

View File

@@ -73,10 +73,12 @@ public class PersistenceExceptionTranslationAdvisor extends AbstractPointcutAdvi
}
@Override
public Advice getAdvice() {
return this.advice;
}
@Override
public Pointcut getPointcut() {
return this.pointcut;
}

View File

@@ -77,6 +77,7 @@ public class PersistenceExceptionTranslationPostProcessor extends AbstractAdvisi
this.repositoryAnnotationType = repositoryAnnotationType;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
if (!(beanFactory instanceof ListableBeanFactory)) {
throw new IllegalArgumentException(

View File

@@ -53,6 +53,7 @@ public class ChainedPersistenceExceptionTranslator implements PersistenceExcepti
}
@Override
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
for (PersistenceExceptionTranslator pet : this.delegates) {
DataAccessException translatedDex = pet.translateExceptionIfPossible(ex);

View File

@@ -39,6 +39,7 @@ public abstract class DaoSupport implements InitializingBean {
protected final Log logger = LogFactory.getLog(getClass());
@Override
public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException {
// Let abstract subclasses check their configuration.
checkDaoConfig();

View File

@@ -107,6 +107,7 @@ public class PersistenceExceptionTranslationInterceptor
this.alwaysTranslate = alwaysTranslate;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (this.persistenceExceptionTranslator == null) {
// No explicit exception translator specified - perform autodetection.
@@ -119,6 +120,7 @@ public class PersistenceExceptionTranslationInterceptor
}
}
@Override
public void afterPropertiesSet() {
if (this.persistenceExceptionTranslator == null) {
throw new IllegalArgumentException("Property 'persistenceExceptionTranslator' is required");
@@ -150,6 +152,7 @@ public class PersistenceExceptionTranslationInterceptor
}
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
try {
return mi.proceed();

View File

@@ -109,6 +109,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
return this.connectionFactory;
}
@Override
public void afterPropertiesSet() {
if (getConnectionFactory() == null) {
throw new IllegalArgumentException("Property 'connectionFactory' is required");
@@ -116,6 +117,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
}
@Override
public Object getResourceFactory() {
return getConnectionFactory();
}

View File

@@ -60,6 +60,7 @@ public class DelegatingConnectionFactory implements ConnectionFactory, Initializ
}
@Override
public void afterPropertiesSet() {
if (getTargetConnectionFactory() == null) {
throw new IllegalArgumentException("Property 'targetConnectionFactory' is required");
@@ -67,26 +68,32 @@ public class DelegatingConnectionFactory implements ConnectionFactory, Initializ
}
@Override
public Connection getConnection() throws ResourceException {
return getTargetConnectionFactory().getConnection();
}
@Override
public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException {
return getTargetConnectionFactory().getConnection(connectionSpec);
}
@Override
public RecordFactory getRecordFactory() throws ResourceException {
return getTargetConnectionFactory().getRecordFactory();
}
@Override
public ResourceAdapterMetaData getMetaData() throws ResourceException {
return getTargetConnectionFactory().getMetaData();
}
@Override
public Reference getReference() throws NamingException {
return getTargetConnectionFactory().getReference();
}
@Override
public void setReference(Reference reference) {
getTargetConnectionFactory().setReference(reference);
}

View File

@@ -41,10 +41,12 @@ import javax.resource.cci.RecordFactory;
*/
public class NotSupportedRecordFactory implements RecordFactory {
@Override
public MappedRecord createMappedRecord(String name) throws ResourceException {
throw new NotSupportedException("The RecordFactory facility is not supported by the connector");
}
@Override
public IndexedRecord createIndexedRecord(String name) throws ResourceException {
throw new NotSupportedException("The RecordFactory facility is not supported by the connector");
}

View File

@@ -129,6 +129,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
* <p>As this bean implements DisposableBean, a bean factory will
* automatically invoke this on destruction of its cached singletons.
*/
@Override
public void destroy() {
resetConnection();
}
@@ -228,6 +229,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals("equals")) {
// Only consider equal when proxies are identical.

View File

@@ -128,6 +128,7 @@ public class TransactionAwareConnectionFactoryProxy extends DelegatingConnection
this.connectionFactory = cf;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// Invocation on Connection interface coming in...

View File

@@ -187,6 +187,7 @@ public class CciTemplate implements CciOperations {
}
@Override
public <T> T execute(ConnectionCallback<T> action) throws DataAccessException {
Assert.notNull(action, "Callback object must not be null");
Connection con = ConnectionFactoryUtils.getConnection(getConnectionFactory(), getConnectionSpec());
@@ -207,9 +208,11 @@ public class CciTemplate implements CciOperations {
}
}
@Override
public <T> T execute(final InteractionCallback<T> action) throws DataAccessException {
Assert.notNull(action, "Callback object must not be null");
return execute(new ConnectionCallback<T>() {
@Override
public T doInConnection(Connection connection, ConnectionFactory connectionFactory)
throws ResourceException, SQLException, DataAccessException {
Interaction interaction = connection.createInteraction();
@@ -223,24 +226,29 @@ public class CciTemplate implements CciOperations {
});
}
@Override
public Record execute(InteractionSpec spec, Record inputRecord) throws DataAccessException {
return doExecute(spec, inputRecord, null, new SimpleRecordExtractor());
}
@Override
public void execute(InteractionSpec spec, Record inputRecord, Record outputRecord) throws DataAccessException {
doExecute(spec, inputRecord, outputRecord, null);
}
@Override
public Record execute(InteractionSpec spec, RecordCreator inputCreator) throws DataAccessException {
return doExecute(spec, createRecord(inputCreator), null, new SimpleRecordExtractor());
}
@Override
public <T> T execute(InteractionSpec spec, Record inputRecord, RecordExtractor<T> outputExtractor)
throws DataAccessException {
return doExecute(spec, inputRecord, null, outputExtractor);
}
@Override
public <T> T execute(InteractionSpec spec, RecordCreator inputCreator, RecordExtractor<T> outputExtractor)
throws DataAccessException {
@@ -263,6 +271,7 @@ public class CciTemplate implements CciOperations {
final RecordExtractor<T> outputExtractor) throws DataAccessException {
return execute(new InteractionCallback<T>() {
@Override
public T doInInteraction(Interaction interaction, ConnectionFactory connectionFactory)
throws ResourceException, SQLException, DataAccessException {
Record outputRecordToUse = outputRecord;
@@ -421,6 +430,7 @@ public class CciTemplate implements CciOperations {
private static class SimpleRecordExtractor implements RecordExtractor<Record> {
@Override
public Record extractData(Record record) {
return record;
}

View File

@@ -59,27 +59,33 @@ public class CommAreaRecord implements Record, Streamable {
}
@Override
public void setRecordName(String recordName) {
this.recordName=recordName;
}
@Override
public String getRecordName() {
return recordName;
}
@Override
public void setRecordShortDescription(String recordShortDescription) {
this.recordShortDescription=recordShortDescription;
}
@Override
public String getRecordShortDescription() {
return recordShortDescription;
}
@Override
public void read(InputStream in) throws IOException {
this.bytes = FileCopyUtils.copyToByteArray(in);
}
@Override
public void write(OutputStream out) throws IOException {
out.write(this.bytes);
out.flush();

View File

@@ -82,6 +82,7 @@ public abstract class EisOperation implements InitializingBean {
}
@Override
public void afterPropertiesSet() {
this.cciTemplate.afterPropertiesSet();

View File

@@ -129,6 +129,7 @@ public abstract class MappingRecordOperation extends EisOperation {
this.inputObject = inObject;
}
@Override
public Record createRecord(RecordFactory recordFactory) throws ResourceException, DataAccessException {
return createInputRecord(recordFactory, this.inputObject);
}
@@ -141,6 +142,7 @@ public abstract class MappingRecordOperation extends EisOperation {
*/
protected class RecordExtractorImpl implements RecordExtractor {
@Override
public Object extractData(Record record) throws ResourceException, SQLException, DataAccessException {
return extractOutputData(record);
}

View File

@@ -46,6 +46,7 @@ class BootstrapContextAwareProcessor implements BeanPostProcessor {
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (this.bootstrapContext != null && bean instanceof BootstrapContextAware) {
((BootstrapContextAware) bean).setBootstrapContext(this.bootstrapContext);
@@ -53,6 +54,7 @@ class BootstrapContextAwareProcessor implements BeanPostProcessor {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
return bean;
}

View File

@@ -60,6 +60,7 @@ public class ResourceAdapterApplicationContext extends GenericApplicationContext
// JCA WorkManager resolved lazily - may not be available.
beanFactory.registerResolvableDependency(WorkManager.class, new ObjectFactory<WorkManager>() {
@Override
public WorkManager getObject() {
return bootstrapContext.getWorkManager();
}

View File

@@ -156,6 +156,7 @@ public class SpringContextResourceAdapter implements ResourceAdapter {
* This implementation loads a Spring ApplicationContext through the
* {@link #createApplicationContext} template method.
*/
@Override
public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
if (logger.isInfoEnabled()) {
logger.info("Starting SpringContextResourceAdapter with BootstrapContext: " + bootstrapContext);
@@ -200,6 +201,7 @@ public class SpringContextResourceAdapter implements ResourceAdapter {
/**
* This implementation closes the Spring ApplicationContext.
*/
@Override
public void stop() {
logger.info("Stopping SpringContextResourceAdapter");
this.applicationContext.close();
@@ -209,6 +211,7 @@ public class SpringContextResourceAdapter implements ResourceAdapter {
/**
* This implementation always throws a NotSupportedException.
*/
@Override
public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec)
throws ResourceException {
@@ -218,12 +221,14 @@ public class SpringContextResourceAdapter implements ResourceAdapter {
/**
* This implementation does nothing.
*/
@Override
public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) {
}
/**
* This implementation always returns {@code null}.
*/
@Override
public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException {
return null;
}

View File

@@ -123,6 +123,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
* @see #setTransactionManager
* @see #setTransactionFactory
*/
@Override
public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException {
return (this.transactionFactory != null);
}
@@ -132,6 +133,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
* <p>This implementation delegates to {@link #createEndpointInternal()},
* initializing the endpoint's XAResource before the endpoint gets invoked.
*/
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
AbstractMessageEndpoint endpoint = createEndpointInternal();
endpoint.initXAResource(xaResource);
@@ -189,6 +191,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
* concrete endpoint method should call {@code beforeDelivery} and its
* sibling {@link #afterDelivery()} explicitly, as part of its own processing.
*/
@Override
public void beforeDelivery(Method method) throws ResourceException {
this.beforeDeliveryCalled = true;
try {
@@ -236,6 +239,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
* to call this method after invoking the concrete endpoint. See the
* explanation in {@link #beforeDelivery}'s javadoc.
*/
@Override
public void afterDelivery() throws ResourceException {
this.beforeDeliveryCalled = false;
Thread.currentThread().setContextClassLoader(this.previousContextClassLoader);
@@ -248,6 +252,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
}
}
@Override
public void release() {
try {
this.transactionDelegate.setRollbackOnly();

View File

@@ -94,6 +94,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
*/
private class GenericMessageEndpoint extends AbstractMessageEndpoint implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
boolean applyDeliveryCalls = !hasBeforeDeliveryBeenCalled();
if (applyDeliveryCalls) {

View File

@@ -224,6 +224,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
* Return the value for the 'autoStartup' property. If "true", this
* endpoint manager will start upon a ContextRefreshedEvent.
*/
@Override
public boolean isAutoStartup() {
return this.autoStartup;
}
@@ -242,6 +243,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
/**
* Return the phase in which this endpoint manager will be started and stopped.
*/
@Override
public int getPhase() {
return this.phase;
}
@@ -250,6 +252,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
* Prepares the message endpoint, and automatically activates it
* if the "autoStartup" flag is set to "true".
*/
@Override
public void afterPropertiesSet() throws ResourceException {
if (getResourceAdapter() == null) {
throw new IllegalArgumentException("Property 'resourceAdapter' is required");
@@ -274,6 +277,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
/**
* Activates the configured message endpoint.
*/
@Override
public void start() {
synchronized (this.lifecycleMonitor) {
if (!this.running) {
@@ -291,6 +295,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
/**
* Deactivates the configured message endpoint.
*/
@Override
public void stop() {
synchronized (this.lifecycleMonitor) {
if (this.running) {
@@ -300,6 +305,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
}
}
@Override
public void stop(Runnable callback) {
synchronized (this.lifecycleMonitor) {
this.stop();
@@ -310,6 +316,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
/**
* Return whether the configured message endpoint is currently active.
*/
@Override
public boolean isRunning() {
synchronized (this.lifecycleMonitor) {
return this.running;
@@ -319,6 +326,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
/**
* Deactivates the message endpoint, preparing it for shutdown.
*/
@Override
public void destroy() {
stop();
}

View File

@@ -109,6 +109,7 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali
this.connectionManager = connectionManager;
}
@Override
public void afterPropertiesSet() throws ResourceException {
if (this.managedConnectionFactory == null) {
throw new IllegalArgumentException("Property 'managedConnectionFactory' is required");
@@ -122,14 +123,17 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali
}
@Override
public Object getObject() {
return this.connectionFactory;
}
@Override
public Class<?> getObjectType() {
return (this.connectionFactory != null ? this.connectionFactory.getClass() : null);
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -113,6 +113,7 @@ public class ResourceAdapterFactoryBean implements FactoryBean<ResourceAdapter>,
* Builds the BootstrapContext and starts the ResourceAdapter with it.
* @see javax.resource.spi.ResourceAdapter#start(javax.resource.spi.BootstrapContext)
*/
@Override
public void afterPropertiesSet() throws ResourceException {
if (this.resourceAdapter == null) {
throw new IllegalArgumentException("'resourceAdapter' or 'resourceAdapterClass' is required");
@@ -124,14 +125,17 @@ public class ResourceAdapterFactoryBean implements FactoryBean<ResourceAdapter>,
}
@Override
public ResourceAdapter getObject() {
return this.resourceAdapter;
}
@Override
public Class<? extends ResourceAdapter> getObjectType() {
return (this.resourceAdapter != null ? this.resourceAdapter.getClass() : ResourceAdapter.class);
}
@Override
public boolean isSingleton() {
return true;
}
@@ -141,6 +145,7 @@ public class ResourceAdapterFactoryBean implements FactoryBean<ResourceAdapter>,
* Stops the ResourceAdapter.
* @see javax.resource.spi.ResourceAdapter#stop()
*/
@Override
public void destroy() {
this.resourceAdapter.stop();
}

View File

@@ -62,6 +62,7 @@ public class SimpleBootstrapContext implements BootstrapContext {
}
@Override
public WorkManager getWorkManager() {
if (this.workManager == null) {
throw new IllegalStateException("No WorkManager available");
@@ -69,10 +70,12 @@ public class SimpleBootstrapContext implements BootstrapContext {
return this.workManager;
}
@Override
public XATerminator getXATerminator() {
return this.xaTerminator;
}
@Override
public Timer createTimer() throws UnavailableException {
return new Timer();
}

View File

@@ -53,6 +53,7 @@ public class DelegatingWork implements Work {
/**
* Delegates execution to the underlying Runnable.
*/
@Override
public void run() {
this.delegate.run();
}
@@ -61,6 +62,7 @@ public class DelegatingWork implements Work {
* This implementation is empty, since we expect the Runnable
* to terminate based on some specific shutdown signal.
*/
@Override
public void release() {
}

View File

@@ -88,10 +88,12 @@ public class SimpleTaskWorkManager implements WorkManager {
}
@Override
public void doWork(Work work) throws WorkException {
doWork(work, WorkManager.INDEFINITE, null, null);
}
@Override
public void doWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
throws WorkException {
@@ -99,10 +101,12 @@ public class SimpleTaskWorkManager implements WorkManager {
executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener);
}
@Override
public long startWork(Work work) throws WorkException {
return startWork(work, WorkManager.INDEFINITE, null, null);
}
@Override
public long startWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
throws WorkException {
@@ -110,10 +114,12 @@ public class SimpleTaskWorkManager implements WorkManager {
return executeWork(this.asyncTaskExecutor, work, startTimeout, true, executionContext, workListener);
}
@Override
public void scheduleWork(Work work) throws WorkException {
scheduleWork(work, WorkManager.INDEFINITE, null, null);
}
@Override
public void scheduleWork(Work work, long startTimeout, ExecutionContext executionContext, WorkListener workListener)
throws WorkException {
@@ -219,6 +225,7 @@ public class SimpleTaskWorkManager implements WorkManager {
this.acceptOnExecution = acceptOnExecution;
}
@Override
public void run() {
if (this.acceptOnExecution) {
this.workListener.workAccepted(new WorkEvent(this, WorkEvent.WORK_ACCEPTED, work, null));
@@ -244,6 +251,7 @@ public class SimpleTaskWorkManager implements WorkManager {
this.workListener.workCompleted(new WorkEvent(this, WorkEvent.WORK_COMPLETED, this.work, null));
}
@Override
public void release() {
this.work.release();
}

View File

@@ -122,6 +122,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
* Specify the JCA BootstrapContext that contains the
* WorkManager to delegate to.
*/
@Override
public void setBootstrapContext(BootstrapContext bootstrapContext) {
Assert.notNull(bootstrapContext, "BootstrapContext must not be null");
this.workManager = bootstrapContext.getWorkManager();
@@ -160,6 +161,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
this.workListener = workListener;
}
@Override
public void afterPropertiesSet() throws NamingException {
if (this.workManager == null) {
if (this.workManagerName != null) {
@@ -186,10 +188,12 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
// Implementation of the Spring SchedulingTaskExecutor interface
//-------------------------------------------------------------------------
@Override
public void execute(Runnable task) {
execute(task, TIMEOUT_INDEFINITE);
}
@Override
public void execute(Runnable task, long startTimeout) {
Assert.state(this.workManager != null, "No WorkManager specified");
Work work = new DelegatingWork(task);
@@ -232,12 +236,14 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
}
}
@Override
public Future<?> submit(Runnable task) {
FutureTask<Object> future = new FutureTask<Object>(task, null);
execute(future, TIMEOUT_INDEFINITE);
return future;
}
@Override
public <T> Future<T> submit(Callable<T> task) {
FutureTask<T> future = new FutureTask<T>(task);
execute(future, TIMEOUT_INDEFINITE);
@@ -247,6 +253,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
/**
* This task executor prefers short-lived work units.
*/
@Override
public boolean prefersShortLivedTasks() {
return true;
}
@@ -256,30 +263,36 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
// Implementation of the JCA WorkManager interface
//-------------------------------------------------------------------------
@Override
public void doWork(Work work) throws WorkException {
this.workManager.doWork(work);
}
@Override
public void doWork(Work work, long delay, ExecutionContext executionContext, WorkListener workListener)
throws WorkException {
this.workManager.doWork(work, delay, executionContext, workListener);
}
@Override
public long startWork(Work work) throws WorkException {
return this.workManager.startWork(work);
}
@Override
public long startWork(Work work, long delay, ExecutionContext executionContext, WorkListener workListener)
throws WorkException {
return this.workManager.startWork(work, delay, executionContext, workListener);
}
@Override
public void scheduleWork(Work work) throws WorkException {
this.workManager.scheduleWork(work);
}
@Override
public void scheduleWork(Work work, long delay, ExecutionContext executionContext, WorkListener workListener)
throws WorkException {

View File

@@ -40,6 +40,7 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
protected AnnotationAttributes enableTx;
protected PlatformTransactionManager txManager;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableTx = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableTransactionManagement.class.getName(), false));

View File

@@ -34,6 +34,7 @@ import org.springframework.transaction.interceptor.TransactionAttribute;
@SuppressWarnings("serial")
public class Ejb3TransactionAnnotationParser implements TransactionAnnotationParser, Serializable {
@Override
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement ae) {
javax.ejb.TransactionAttribute ann = ae.getAnnotation(javax.ejb.TransactionAttribute.class);
if (ann != null) {

View File

@@ -35,6 +35,7 @@ import org.springframework.transaction.interceptor.TransactionAttribute;
@SuppressWarnings("serial")
public class SpringTransactionAnnotationParser implements TransactionAnnotationParser, Serializable {
@Override
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement ae) {
Transactional ann = AnnotationUtils.getAnnotation(ae, Transactional.class);
if (ann != null) {

View File

@@ -73,6 +73,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
* {@link AopNamespaceUtils#registerAutoProxyCreatorIfNecessary register an AutoProxyCreator}
* with the container as necessary.
*/
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
String mode = element.getAttribute("mode");
if ("aspectj".equals(mode)) {

View File

@@ -50,6 +50,7 @@ public class TxNamespaceHandler extends NamespaceHandlerSupport {
}
@Override
public void init() {
registerBeanDefinitionParser("advice", new TxAdviceBeanDefinitionParser());
registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenBeanDefinitionParser());

View File

@@ -80,6 +80,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
* @return TransactionAttribute for this method, or {@code null} if the method
* is not transactional
*/
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
// First, see if we have a cached value.
Object cacheKey = getCacheKey(method, targetClass);

View File

@@ -61,6 +61,7 @@ public class BeanFactoryTransactionAttributeSourceAdvisor extends AbstractBeanFa
this.pointcut.setClassFilter(classFilter);
}
@Override
public Pointcut getPointcut() {
return this.pointcut;
}

View File

@@ -52,6 +52,7 @@ public class CompositeTransactionAttributeSource implements TransactionAttribute
}
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
for (TransactionAttributeSource tas : this.transactionAttributeSources) {
TransactionAttribute ta = tas.getTransactionAttribute(method, targetClass);

View File

@@ -82,6 +82,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
/**
* Return a qualifier value associated with this transaction attribute.
*/
@Override
public String getQualifier() {
return this.qualifier;
}
@@ -91,6 +92,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
* Additionally attempt to rollback on Error.
* <p>This is consistent with TransactionTemplate's default behavior.
*/
@Override
public boolean rollbackOn(Throwable ex) {
return (ex instanceof RuntimeException || ex instanceof Error);
}

View File

@@ -46,10 +46,12 @@ public abstract class DelegatingTransactionAttribute extends DelegatingTransacti
}
@Override
public String getQualifier() {
return this.targetAttribute.getQualifier();
}
@Override
public boolean rollbackOn(Throwable ex) {
return this.targetAttribute.rollbackOn(ex);
}

View File

@@ -50,6 +50,7 @@ public class MatchAlwaysTransactionAttributeSource implements TransactionAttribu
}
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
return this.transactionAttribute;
}

View File

@@ -81,6 +81,7 @@ public class MethodMapTransactionAttributeSource
this.methodMap = methodMap;
}
@Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
}
@@ -91,6 +92,7 @@ public class MethodMapTransactionAttributeSource
* {@link #setMethodMap(java.util.Map) "methodMap"}, if any.
* @see #initMethodMap(java.util.Map)
*/
@Override
public void afterPropertiesSet() {
initMethodMap(this.methodMap);
this.eagerlyInitialized = true;
@@ -204,6 +206,7 @@ public class MethodMapTransactionAttributeSource
}
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
if (this.eagerlyInitialized) {
return this.transactionAttributeMap.get(method);

View File

@@ -98,6 +98,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
}
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
// look for direct name match
String methodName = method.getName();

View File

@@ -206,6 +206,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
/**
* Set the BeanFactory to use for retrieving PlatformTransactionManager beans.
*/
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@@ -220,6 +221,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
/**
* Check that required properties were set.
*/
@Override
public void afterPropertiesSet() {
if (this.transactionManager == null && this.beanFactory == null) {
throw new IllegalStateException(

View File

@@ -79,10 +79,12 @@ public class TransactionAttributeSourceAdvisor extends AbstractPointcutAdvisor {
}
@Override
public Advice getAdvice() {
return this.transactionInterceptor;
}
@Override
public Pointcut getPointcut() {
return this.pointcut;
}

View File

@@ -32,6 +32,7 @@ import org.springframework.util.ObjectUtils;
@SuppressWarnings("serial")
abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
@Override
public boolean matches(Method method, Class targetClass) {
TransactionAttributeSource tas = getTransactionAttributeSource();
return (tas == null || tas.getTransactionAttribute(method, targetClass) != null);

View File

@@ -88,6 +88,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
}
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
// Work out the target class: may be {@code null}.
// The TransactionAttributeSource should be passed the target class
@@ -126,6 +127,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
try {
Object result = ((CallbackPreferringPlatformTransactionManager) tm).execute(txAttr,
new TransactionCallback<Object>() {
@Override
public Object doInTransaction(TransactionStatus status) {
TransactionInfo txInfo = prepareTransactionInfo(tm, txAttr, joinpointIdentification, status);
try {

View File

@@ -180,6 +180,7 @@ public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBe
* @see org.springframework.beans.factory.BeanFactoryUtils#beanOfTypeIncludingAncestors
* @see org.springframework.transaction.PlatformTransactionManager
*/
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.transactionInterceptor.setBeanFactory(beanFactory);
}

View File

@@ -49,9 +49,11 @@ public class JtaAfterCompletionSynchronization implements Synchronization {
}
@Override
public void beforeCompletion() {
}
@Override
public void afterCompletion(int status) {
switch (status) {
case Status.STATUS_COMMITTED:

View File

@@ -410,6 +410,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
* Initialize the UserTransaction as well as the TransactionManager handle.
* @see #initUserTransactionAndTransactionManager()
*/
@Override
public void afterPropertiesSet() throws TransactionSystemException {
initUserTransactionAndTransactionManager();
checkUserTransactionAndTransactionManager();
@@ -1164,6 +1165,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
// Implementation of TransactionFactory interface
//---------------------------------------------------------------------
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
TransactionManager tm = getTransactionManager();
Assert.state(tm != null, "No JTA TransactionManager available");
@@ -1174,6 +1176,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
return new ManagedTransactionAdapter(tm);
}
@Override
public boolean supportsResourceAdapterManagedTransactions() {
return false;
}

View File

@@ -60,6 +60,7 @@ public class JtaTransactionObject implements SmartTransactionObject {
/**
* This implementation checks the UserTransaction's rollback-only flag.
*/
@Override
public boolean isRollbackOnly() {
if (this.userTransaction == null) {
return false;
@@ -78,6 +79,7 @@ public class JtaTransactionObject implements SmartTransactionObject {
* assuming that they will flush all affected ORM sessions.
* @see org.springframework.transaction.support.TransactionSynchronization#flush()
*/
@Override
public void flush() {
TransactionSynchronizationUtils.triggerFlush();
}

View File

@@ -57,31 +57,38 @@ public class ManagedTransactionAdapter implements Transaction {
}
@Override
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
SecurityException, SystemException {
this.transactionManager.commit();
}
@Override
public void rollback() throws SystemException {
this.transactionManager.rollback();
}
@Override
public void setRollbackOnly() throws SystemException {
this.transactionManager.setRollbackOnly();
}
@Override
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}
@Override
public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException {
return this.transactionManager.getTransaction().enlistResource(xaRes);
}
@Override
public boolean delistResource(XAResource xaRes, int flag) throws SystemException {
return this.transactionManager.getTransaction().delistResource(xaRes, flag);
}
@Override
public void registerSynchronization(Synchronization sync) throws RollbackException, SystemException {
this.transactionManager.getTransaction().registerSynchronization(sync);
}

View File

@@ -50,6 +50,7 @@ public class SimpleTransactionFactory implements TransactionFactory {
}
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
if (timeout >= 0) {
this.transactionManager.setTransactionTimeout(timeout);
@@ -58,6 +59,7 @@ public class SimpleTransactionFactory implements TransactionFactory {
return new ManagedTransactionAdapter(this.transactionManager);
}
@Override
public boolean supportsResourceAdapterManagedTransactions() {
return false;
}

View File

@@ -113,6 +113,7 @@ public class SpringJtaSynchronizationAdapter implements Synchronization {
* <p>In case of an exception, the JTA transaction will be marked as rollback-only.
* @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit
*/
@Override
public void beforeCompletion() {
try {
boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly();
@@ -168,6 +169,7 @@ public class SpringJtaSynchronizationAdapter implements Synchronization {
* @see org.springframework.transaction.support.TransactionSynchronization#beforeCompletion
* @see org.springframework.transaction.support.TransactionSynchronization#afterCompletion
*/
@Override
public void afterCompletion(int status) {
if (!this.beforeCompletionCalled) {
// beforeCompletion not called before (probably because of JTA rollback).

View File

@@ -65,28 +65,34 @@ public class UserTransactionAdapter implements UserTransaction {
}
@Override
public void setTransactionTimeout(int timeout) throws SystemException {
this.transactionManager.setTransactionTimeout(timeout);
}
@Override
public void begin() throws NotSupportedException, SystemException {
this.transactionManager.begin();
}
@Override
public void commit()
throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
SecurityException, SystemException {
this.transactionManager.commit();
}
@Override
public void rollback() throws SecurityException, SystemException {
this.transactionManager.rollback();
}
@Override
public void setRollbackOnly() throws SystemException {
this.transactionManager.setRollbackOnly();
}
@Override
public int getStatus() throws SystemException {
return this.transactionManager.getStatus();
}

View File

@@ -211,6 +211,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
}
@Override
public <T> T execute(TransactionDefinition definition, TransactionCallback<T> callback) throws TransactionException {
if (definition == null) {
// Use defaults if no transaction definition given.
@@ -330,6 +331,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
this.debug = debug;
}
@Override
public void run() {
DefaultTransactionStatus status = prepareTransactionStatus(
this.definition, (this.actualTransaction ? this : null),

View File

@@ -332,6 +332,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @see #isExistingTransaction
* @see #doBegin
*/
@Override
public final TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
Object transaction = doGetTransaction();
@@ -693,6 +694,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @see #doCommit
* @see #rollback
*/
@Override
public final void commit(TransactionStatus status) throws TransactionException {
if (status.isCompleted()) {
throw new IllegalTransactionStateException(
@@ -813,6 +815,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @see #doRollback
* @see #doSetRollbackOnly
*/
@Override
public final void rollback(TransactionStatus status) throws TransactionException {
if (status.isCompleted()) {
throw new IllegalTransactionStateException(

View File

@@ -56,6 +56,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
// Handling of current transaction state
//---------------------------------------------------------------------
@Override
public void setRollbackOnly() {
this.rollbackOnly = true;
}
@@ -67,6 +68,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
* @see #isLocalRollbackOnly()
* @see #isGlobalRollbackOnly()
*/
@Override
public boolean isRollbackOnly() {
return (isLocalRollbackOnly() || isGlobalRollbackOnly());
}
@@ -92,6 +94,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
/**
* This implementations is empty, considering flush as a no-op.
*/
@Override
public void flush() {
}
@@ -102,6 +105,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
this.completed = true;
}
@Override
public boolean isCompleted() {
return this.completed;
}
@@ -126,6 +130,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
return this.savepoint;
}
@Override
public boolean hasSavepoint() {
return (this.savepoint != null);
}
@@ -172,6 +177,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
* @see #getSavepointManager()
* @see org.springframework.transaction.SavepointManager
*/
@Override
public Object createSavepoint() throws TransactionException {
return getSavepointManager().createSavepoint();
}
@@ -183,6 +189,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
* @see #getSavepointManager()
* @see org.springframework.transaction.SavepointManager
*/
@Override
public void rollbackToSavepoint(Object savepoint) throws TransactionException {
getSavepointManager().rollbackToSavepoint(savepoint);
}
@@ -193,6 +200,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
* @see #getSavepointManager()
* @see org.springframework.transaction.SavepointManager
*/
@Override
public void releaseSavepoint(Object savepoint) throws TransactionException {
getSavepointManager().releaseSavepoint(savepoint);
}

View File

@@ -134,6 +134,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
this.propagationBehavior = propagationBehavior;
}
@Override
public final int getPropagationBehavior() {
return this.propagationBehavior;
}
@@ -168,6 +169,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
this.isolationLevel = isolationLevel;
}
@Override
public final int getIsolationLevel() {
return this.isolationLevel;
}
@@ -184,6 +186,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
this.timeout = timeout;
}
@Override
public final int getTimeout() {
return this.timeout;
}
@@ -196,6 +199,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
this.readOnly = readOnly;
}
@Override
public final boolean isReadOnly() {
return this.readOnly;
}
@@ -209,6 +213,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
this.name = name;
}
@Override
public final String getName() {
return this.name;
}

View File

@@ -103,6 +103,7 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
return (this.transaction != null);
}
@Override
public boolean isNewTransaction() {
return (hasTransaction() && this.newTransaction);
}

View File

@@ -46,22 +46,27 @@ public abstract class DelegatingTransactionDefinition implements TransactionDefi
}
@Override
public int getPropagationBehavior() {
return this.targetDefinition.getPropagationBehavior();
}
@Override
public int getIsolationLevel() {
return this.targetDefinition.getIsolationLevel();
}
@Override
public int getTimeout() {
return this.targetDefinition.getTimeout();
}
@Override
public boolean isReadOnly() {
return this.targetDefinition.isReadOnly();
}
@Override
public String getName() {
return this.targetDefinition.getName();
}

View File

@@ -177,15 +177,18 @@ public abstract class ResourceHolderSupport implements ResourceHolder {
/**
* Reset this resource holder - transactional state as well as reference count.
*/
@Override
public void reset() {
clear();
this.referenceCount = 0;
}
@Override
public void unbound() {
this.isVoid = true;
}
@Override
public boolean isVoid() {
return this.isVoid;
}

View File

@@ -45,25 +45,30 @@ public abstract class ResourceHolderSynchronization<H extends ResourceHolder, K>
}
@Override
public void suspend() {
if (this.holderActive) {
TransactionSynchronizationManager.unbindResource(this.resourceKey);
}
}
@Override
public void resume() {
if (this.holderActive) {
TransactionSynchronizationManager.bindResource(this.resourceKey, this.resourceHolder);
}
}
@Override
public void flush() {
flushResource(this.resourceHolder);
}
@Override
public void beforeCommit(boolean readOnly) {
}
@Override
public void beforeCompletion() {
if (shouldUnbindAtCompletion()) {
TransactionSynchronizationManager.unbindResource(this.resourceKey);
@@ -74,12 +79,14 @@ public abstract class ResourceHolderSynchronization<H extends ResourceHolder, K>
}
}
@Override
public void afterCommit() {
if (!shouldReleaseBeforeCompletion()) {
processResourceAfterCommit(this.resourceHolder);
}
}
@Override
public void afterCompletion(int status) {
if (shouldUnbindAtCompletion()) {
boolean releaseNecessary = false;

View File

@@ -57,6 +57,7 @@ public class SimpleTransactionStatus extends AbstractTransactionStatus {
}
@Override
public boolean isNewTransaction() {
return this.newTransaction;
}

View File

@@ -29,6 +29,7 @@ import org.springframework.transaction.TransactionStatus;
*/
public abstract class TransactionCallbackWithoutResult implements TransactionCallback<Object> {
@Override
public final Object doInTransaction(TransactionStatus status) {
doInTransactionWithoutResult(status);
return null;

View File

@@ -32,28 +32,36 @@ import org.springframework.core.Ordered;
*/
public abstract class TransactionSynchronizationAdapter implements TransactionSynchronization, Ordered {
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
@Override
public void suspend() {
}
@Override
public void resume() {
}
@Override
public void flush() {
}
@Override
public void beforeCommit(boolean readOnly) {
}
@Override
public void beforeCompletion() {
}
@Override
public void afterCommit() {
}
@Override
public void afterCompletion(int status) {
}

View File

@@ -113,6 +113,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
return this.transactionManager;
}
@Override
public void afterPropertiesSet() {
if (this.transactionManager == null) {
throw new IllegalArgumentException("Property 'transactionManager' is required");
@@ -120,6 +121,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
}
@Override
public <T> T execute(TransactionCallback<T> action) throws TransactionException {
if (this.transactionManager instanceof CallbackPreferringPlatformTransactionManager) {
return ((CallbackPreferringPlatformTransactionManager) this.transactionManager).execute(this, action);