org.springframework.transaction.interceptor
Class RuleBasedTransactionAttribute

java.lang.Object
  extended byorg.springframework.transaction.support.DefaultTransactionDefinition
      extended byorg.springframework.transaction.interceptor.DefaultTransactionAttribute
          extended byorg.springframework.transaction.interceptor.RuleBasedTransactionAttribute
All Implemented Interfaces:
TransactionAttribute, TransactionDefinition

public class RuleBasedTransactionAttribute
extends DefaultTransactionAttribute

TransactionAttribute implementation that works out whether a given exception should cause transaction rollback by applying a number of rollback rules, both positive and negative. If no rules are relevant to the exception, it behaves like DefaultTransactionAttribute (rolling back on runtime exceptions).
The TransactionAttributeEditor property editor creates objects of this class.

Since:
09-Apr-2003
Version:
$Id: RuleBasedTransactionAttribute.java,v 1.3 2004/03/18 02:46:05 trisberg Exp $
Author:
Rod Johnson

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Fields inherited from class org.springframework.transaction.interceptor.DefaultTransactionAttribute
COMMIT_RULE_PREFIX, ROLLBACK_RULE_PREFIX
 
Fields inherited from class org.springframework.transaction.support.DefaultTransactionDefinition
READ_ONLY_MARKER, TIMEOUT_PREFIX
 
Fields inherited from interface org.springframework.transaction.TransactionDefinition
ISOLATION_CONSTANT_PREFIX, ISOLATION_DEFAULT, ISOLATION_READ_COMMITTED, ISOLATION_READ_UNCOMMITTED, ISOLATION_REPEATABLE_READ, ISOLATION_SERIALIZABLE, PROPAGATION_CONSTANT_PREFIX, PROPAGATION_MANDATORY, PROPAGATION_NEVER, PROPAGATION_NOT_SUPPORTED, PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, PROPAGATION_SUPPORTS, TIMEOUT_DEFAULT
 
Constructor Summary
RuleBasedTransactionAttribute()
           
RuleBasedTransactionAttribute(int propagationBehavior, java.util.List rollbackRules)
           
 
Method Summary
 java.util.List getRollbackRules()
           
 boolean rollbackOn(java.lang.Throwable t)
          Winning rule is the shallowest rule (that is, the closest in the inheritance hierarchy to the exception).
 void setRollbackRules(java.util.List rollbackRules)
           
 java.lang.String toString()
          Return a description of this transaction attribute.
 
Methods inherited from class org.springframework.transaction.support.DefaultTransactionDefinition
equals, getDefinitionDescription, getIsolationLevel, getPropagationBehavior, getTimeout, hashCode, isReadOnly, setIsolationLevel, setIsolationLevelName, setPropagationBehavior, setPropagationBehaviorName, setReadOnly, setTimeout
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.transaction.TransactionDefinition
getIsolationLevel, getPropagationBehavior, getTimeout, isReadOnly
 

Field Detail

logger

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

RuleBasedTransactionAttribute

public RuleBasedTransactionAttribute()

RuleBasedTransactionAttribute

public RuleBasedTransactionAttribute(int propagationBehavior,
                                     java.util.List rollbackRules)
Method Detail

setRollbackRules

public void setRollbackRules(java.util.List rollbackRules)

getRollbackRules

public java.util.List getRollbackRules()

rollbackOn

public boolean rollbackOn(java.lang.Throwable t)
Winning rule is the shallowest rule (that is, the closest in the inheritance hierarchy to the exception). If no rule applies (-1), return false.

Specified by:
rollbackOn in interface TransactionAttribute
Overrides:
rollbackOn in class DefaultTransactionAttribute
See Also:
TransactionAttribute.rollbackOn(java.lang.Throwable)

toString

public java.lang.String toString()
Description copied from class: DefaultTransactionAttribute
Return a description of this transaction attribute. The format matches the one used by TransactionAttributeEditor, to be able to feed toString results into TransactionAttribute properties.

Overrides:
toString in class DefaultTransactionAttribute
See Also:
TransactionAttributeEditor


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