org.springframework.transaction.interceptor
Class AttributesTransactionAttributeSource
java.lang.Object
org.springframework.transaction.interceptor.AttributesTransactionAttributeSource
- All Implemented Interfaces:
- TransactionAttributeSource
- 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.
- Version:
- $Id: AttributesTransactionAttributeSource.java,v 1.6 2004/03/18 02:46:05 trisberg Exp $
- Author:
- Rod Johnson
- See Also:
Attributes
Field Summary |
protected org.apache.commons.logging.Log |
logger
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final org.apache.commons.logging.Log logger
AttributesTransactionAttributeSource
public AttributesTransactionAttributeSource(Attributes attributes)
getTransactionAttribute
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
- Parameters:
method
- method for the current invocation. Can't be nulltargetClass
- target class for this invocation. May be null.
- Returns:
- TransactionAttribute for this method, or null if the method is non-transactional
computeTransactionAttribute
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.
findTransactionAttribute
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.
- 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) 2003-2004 The Spring Framework Project.