Class AttributesTransactionAttributeSource

  extended byorg.springframework.transaction.interceptor.AttributesTransactionAttributeSource
All Implemented Interfaces:

public class AttributesTransactionAttributeSource
extends java.lang.Object
implements TransactionAttributeSource

Implementation of TransactionAttributeSource that uses attributes from an Attributes implementation. Defaults to using class's transaction attribute if none is associated with the target method. Any transaction attribute associated with the target method completely overrides a class transaction attribute.
This implementation caches attributes by method after they are first used. If it's ever desirable to allow dynamic changing of transaction attributes (unlikely) caching could be made configurable. Caching is desirable because of the cost of evaluating rollback rules.

$Id:,v 1.6 2004/03/18 02:46:05 trisberg Exp $
Rod Johnson
See Also:

Field Summary
protected  org.apache.commons.logging.Log logger
Constructor Summary
AttributesTransactionAttributeSource(Attributes attributes)
Method Summary
protected  TransactionAttribute computeTransactionAttribute(java.lang.reflect.Method method, java.lang.Class targetClass)
          Same return as getTransactionAttribute method, but doesn't cache the result.
protected  TransactionAttribute findTransactionAttribute(java.util.Collection atts)
          Return the transaction attribute, given this set of attributes attached to a method or class.
 TransactionAttribute getTransactionAttribute(java.lang.reflect.Method method, java.lang.Class targetClass)
          Return the transaction attribute for this method invocation.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected final org.apache.commons.logging.Log logger
Constructor Detail


public AttributesTransactionAttributeSource(Attributes attributes)
Method Detail


public TransactionAttribute getTransactionAttribute(java.lang.reflect.Method method,
                                                    java.lang.Class targetClass)
Return the transaction attribute for this method invocation. Defaults to the class's transaction attribute if no method attribute is found

Specified by:
getTransactionAttribute in interface TransactionAttributeSource
method - method for the current invocation. Can't be null
targetClass - target class for this invocation. May be null.
TransactionAttribute for this method, or null if the method is non-transactional


protected TransactionAttribute computeTransactionAttribute(java.lang.reflect.Method method,
                                                           java.lang.Class targetClass)
Same return as getTransactionAttribute method, but doesn't cache the result. getTransactionAttribute is a caching decorator for this method.


protected TransactionAttribute findTransactionAttribute(java.util.Collection atts)
Return the transaction attribute, given this set of attributes attached to a method or class. Protected rather than private as subclasses may want to customize how this is done: for example, returning a TransactionAttribute affected by the values of other attributes. This implementation takes into account RollbackRuleAttributes, if the TransactionAttribute is a RuleBasedTransactionAttribute. Return null if it's not transactional.

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

Copyright (C) 2003-2004 The Spring Framework Project.