org.skife.intercept.interceptors.tx
Class TransactionInterceptor

java.lang.Object
  |
  +--org.skife.intercept.interceptors.tx.TransactionInterceptor
All Implemented Interfaces:
Interceptor

public class TransactionInterceptor
extends java.lang.Object
implements Interceptor

Provides container managed transactions for arbitrary containers and transaction types.

If the intercepted class responds to setTransaction(Transaction) than the current transaction will be populated onto it before the stack is yielded.

See Also:
TransactionFactory, Transaction

Constructor Summary
TransactionInterceptor()
          Designed for Type 2 IoC - setTransactionFactory(...) must be called
TransactionInterceptor(org.skife.intercept.interceptors.tx.TransactionFactory factory)
          Designed for Type 3 IoC
 
Method Summary
 java.lang.Object intercept(java.lang.Object base, java.lang.reflect.Method method, java.lang.Object[] args, org.skife.intercept.InterceptorStack stack)
          Do the work
 void setTransactionFactory(org.skife.intercept.interceptors.tx.TransactionFactory factory)
          Specify the transaction factory implementation to use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionInterceptor

public TransactionInterceptor()
Designed for Type 2 IoC - setTransactionFactory(...) must be called


TransactionInterceptor

public TransactionInterceptor(org.skife.intercept.interceptors.tx.TransactionFactory factory)
Designed for Type 3 IoC

Parameters:
factory - Transactionfactory to use.
Method Detail

setTransactionFactory

public void setTransactionFactory(org.skife.intercept.interceptors.tx.TransactionFactory factory)
Specify the transaction factory implementation to use

Parameters:
factory -

intercept

public java.lang.Object intercept(java.lang.Object base,
                                  java.lang.reflect.Method method,
                                  java.lang.Object[] args,
                                  org.skife.intercept.InterceptorStack stack)
                           throws java.lang.Throwable
Do the work

Specified by:
intercept in interface Interceptor
Parameters:
base - A reference to the base object being intercepted
method - A reference to the Method being intercepted
args - The invocation arguments
stack - The InterceptorStack
Returns:
a value to be returned by the method invocation
java.lang.Throwable