com.interface21.transaction.interceptor
Class RuleBasedTransactionAttribute

java.lang.Object
  |
  +--com.interface21.transaction.support.DefaultTransactionDefinition
        |
        +--com.interface21.transaction.interceptor.DefaultTransactionAttribute
              |
              +--com.interface21.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.1 2003/06/13 13:40:38 jhoeller Exp $
Author:
Rod Johnson

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Fields inherited from interface com.interface21.transaction.TransactionDefinition
ISOLATION_CONSTANT_PREFIX, ISOLATION_DEFAULT, ISOLATION_READ_COMMITTED, ISOLATION_READ_UNCOMMITTED, ISOLATION_REPEATABLE_READ, ISOLATION_SERIALIZABLE, PROPAGATION_CONSTANT_PREFIX, PROPAGATION_MANDATORY, PROPAGATION_REQUIRED, PROPAGATION_SUPPORTS, TIMEOUT_DEFAULT
 
Constructor Summary
RuleBasedTransactionAttribute(int propagationBehavior, int isolationLevel, java.util.List rollbackRules)
           
RuleBasedTransactionAttribute(java.util.List rollbackRules)
           
 
Method Summary
 boolean rollBackOn(java.lang.Throwable t)
          Winning rule is the shallowest rule (that is, the closest in the inheritance hierarchy to the exception).
 
Methods inherited from class com.interface21.transaction.support.DefaultTransactionDefinition
getIsolationLevel, getPropagationBehavior, getTimeout, setIsolationLevel, setPropagationBehavior, setTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.interface21.transaction.TransactionDefinition
getIsolationLevel, getPropagationBehavior, getTimeout
 

Field Detail

logger

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

RuleBasedTransactionAttribute

public RuleBasedTransactionAttribute(java.util.List rollbackRules)

RuleBasedTransactionAttribute

public RuleBasedTransactionAttribute(int propagationBehavior,
                                     int isolationLevel,
                                     java.util.List rollbackRules)
Parameters:
propagationBehavior -  
isolationLevel -  
Method Detail

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.
Overrides:
rollBackOn in class DefaultTransactionAttribute
See Also:
TransactionAttribute.rollBackOn(java.lang.Throwable)


Rod Johnson and Spring contributors 2001-2003.