org.springframework.transaction.annotation
Class AnnotationTransactionAttributeSource

java.lang.Object
  extended by org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
      extended by org.springframework.transaction.annotation.AnnotationTransactionAttributeSource
All Implemented Interfaces:
Serializable, TransactionAttributeSource

public class AnnotationTransactionAttributeSource
extends AbstractFallbackTransactionAttributeSource
implements Serializable

Implementation of TransactionAttributeSource for working with transaction metadata in JDK 1.5+ annotation format.

This class reads the JDK 1.5+ Transactional annotation and exposes corresponding transaction attributes to Spring's transaction infrastructure.

This is a direct alternative to AttributesTransactionAttributeSource, which is able to read in source-level attributes via Commons Attributes.

Since:
1.2
Author:
Colin Sampaleanu, Juergen Hoeller
See Also:
Transactional, TransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource), TransactionProxyFactoryBean.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource), AttributesTransactionAttributeSource, CommonsAttributes, Serialized Form

Field Summary
 
Fields inherited from class org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
logger
 
Constructor Summary
AnnotationTransactionAttributeSource()
           
 
Method Summary
protected  Collection findAllAttributes(Class clazz)
          Returns all JDK 1.5+ annotations found for the given class.
protected  Collection findAllAttributes(Method method)
          Returns all JDK 1.5+ annotations found for the given method.
protected  TransactionAttribute findTransactionAttribute(Collection atts)
          Return the transaction attribute, given this set of attributes attached to a method or class.
 
Methods inherited from class org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
getCacheKey, getTransactionAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationTransactionAttributeSource

public AnnotationTransactionAttributeSource()
Method Detail

findAllAttributes

protected Collection findAllAttributes(Method method)
Returns all JDK 1.5+ annotations found for the given method.

Specified by:
findAllAttributes in class AbstractFallbackTransactionAttributeSource
Parameters:
method - the method to retrieve attributes for
Returns:
all attributes associated with this method. May return null.

findAllAttributes

protected Collection findAllAttributes(Class clazz)
Returns all JDK 1.5+ annotations found for the given class.

Specified by:
findAllAttributes in class AbstractFallbackTransactionAttributeSource
Parameters:
clazz - class to retrieve attributes for
Returns:
all attributes associated with this class. May return null.

findTransactionAttribute

protected TransactionAttribute findTransactionAttribute(Collection atts)
Return the transaction attribute, given this set of attributes attached to a method or class. Overrides method from parent class. This version actually converts JDK 5.0+ Annotations to the Spring classes. Returns null if it's not transactional.

Overrides:
findTransactionAttribute in class AbstractFallbackTransactionAttributeSource
Parameters:
atts - attributes attached to a method or class. May be null, in which case a null TransactionAttribute will be returned.
Returns:
TransactionAttribute configured transaction attribute, or null if none was found


Copyright (c) 2002-2006 The Spring Framework Project.