org.springframework.transaction.interceptor
Class AttributesTransactionAttributeSource

java.lang.Object
  extended by org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
      extended by org.springframework.transaction.interceptor.AttributesTransactionAttributeSource
All Implemented Interfaces:
InitializingBean, TransactionAttributeSource

public class AttributesTransactionAttributeSource
extends AbstractFallbackTransactionAttributeSource
implements InitializingBean

Implementation of the TransactionAttributeSource interface that reads metadata via Spring's Attributes abstraction.

Typically used for reading in source-level attributes via Commons Attributes.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Attributes, CommonsAttributes

Field Summary
 
Fields inherited from class org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
logger
 
Constructor Summary
AttributesTransactionAttributeSource()
          Create a new AttributesTransactionAttributeSource.
AttributesTransactionAttributeSource(Attributes attributes)
          Create a new AttributesTransactionAttributeSource.
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 boolean equals(Object other)
           
protected  TransactionAttribute findTransactionAttribute(Class clazz)
          Subclasses need to implement this to return the transaction attribute for the given class, if any.
protected  TransactionAttribute findTransactionAttribute(Collection atts)
          Return the transaction attribute, given this set of attributes attached to a method or class.
protected  TransactionAttribute findTransactionAttribute(Method method)
          Subclasses need to implement this to return the transaction attribute for the given method, if any.
 int hashCode()
           
 void setAttributes(Attributes attributes)
          Set the Attributes implementation to use.
 
Methods inherited from class org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
allowPublicMethodsOnly, getCacheKey, getTransactionAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributesTransactionAttributeSource

public AttributesTransactionAttributeSource()
Create a new AttributesTransactionAttributeSource.

See Also:
setAttributes(org.springframework.metadata.Attributes)

AttributesTransactionAttributeSource

public AttributesTransactionAttributeSource(Attributes attributes)
Create a new AttributesTransactionAttributeSource.

Parameters:
attributes - the Attributes implementation to use
See Also:
CommonsAttributes
Method Detail

setAttributes

public void setAttributes(Attributes attributes)
Set the Attributes implementation to use.

See Also:
CommonsAttributes

afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean

findTransactionAttribute

protected TransactionAttribute findTransactionAttribute(Method method)
Description copied from class: AbstractFallbackTransactionAttributeSource
Subclasses need to implement this to return the transaction attribute for the given method, if any.

Specified by:
findTransactionAttribute in class AbstractFallbackTransactionAttributeSource
Parameters:
method - the method to retrieve the attribute for
Returns:
all transaction attribute associated with this method (or null if none)

findTransactionAttribute

protected TransactionAttribute findTransactionAttribute(Class clazz)
Description copied from class: AbstractFallbackTransactionAttributeSource
Subclasses need to implement this to return the transaction attribute for the given class, if any.

Specified by:
findTransactionAttribute in class AbstractFallbackTransactionAttributeSource
Parameters:
clazz - the class to retrieve the attribute for
Returns:
all transaction attribute associated with this class (or null if none)

findTransactionAttribute

protected TransactionAttribute findTransactionAttribute(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.

Parameters:
atts - attributes attached to a method or class (may be null)
Returns:
TransactionAttribute the corresponding transaction attribute, or null if none was found

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2002-2008 The Spring Framework.