org.slim3.transaction.controller
Class AbstractTransactionController

java.lang.Object
  extended by org.slim3.transaction.controller.AbstractTransactionController
All Implemented Interfaces:
TransactionController
Direct Known Subclasses:
JtaTransactionController, WebSphereTransactionController

public abstract class AbstractTransactionController
extends Object
implements TransactionController

An abstract class for TransactionController.

Since:
3.0
Author:
higa

Constructor Summary
AbstractTransactionController()
           
 
Method Summary
protected  Object execute(TransactionAction action)
          Executes the action
protected abstract  boolean hasTransaction()
          Returns true if the current thread has a transaction.
 Object mandatory(TransactionAction action)
          Executes the action within a transaction.
 Object never(TransactionAction action)
          If the client is associated with a transaction, the controller throws a RemoteException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.slim3.transaction.controller.TransactionController
notSupported, required, requiresNew, setRollbackOnly
 

Constructor Detail

AbstractTransactionController

public AbstractTransactionController()
Method Detail

mandatory

public Object mandatory(TransactionAction action)
                 throws Exception
Description copied from interface: TransactionController
Executes the action within a transaction. If the client is not associated with a transaction, the controller throws the TransactionRequiredException.

Specified by:
mandatory in interface TransactionController
Parameters:
action - the called back action
Returns:
a result which the action returns
Throws:
TransactionRequiredException - if the client is not associated with a transaction
Exception - if an exception is encountered

never

public Object never(TransactionAction action)
             throws Exception
Description copied from interface: TransactionController
If the client is associated with a transaction, the controller throws a RemoteException. If the client is not associated with a transaction, the controller does not start a new transaction before executing the action.

Specified by:
never in interface TransactionController
Parameters:
action - the action
Returns:
a result which the action returns
Throws:
RemoteException - if the client is associated with a transaction
Exception - if an exception is encountered

hasTransaction

protected abstract boolean hasTransaction()
                                   throws Exception
Returns true if the current thread has a transaction.

Returns:
whether the current thread has a transaction
Throws:
Exception - if an exception is encountered
See Also:
UserTransaction.getStatus()

execute

protected Object execute(TransactionAction action)
                  throws Exception
Executes the action

Parameters:
action - the action
Returns:
a result which the action returns
Throws:
Exception - if an exception is encountered


Copyright © 2008-2009 The Slim3 project. All Rights Reserved.