org.opensubsystems.core.util
Interface TransactionFactory

All Known Subinterfaces:
DatabaseTransactionFactory
All Known Implementing Classes:
DatabaseTransactionFactoryImpl, J2EETransactionFactoryImpl, JOTMTransactionFactoryImpl, SimpleLocalTransactionFactoryImpl

public interface TransactionFactory

Interface to encapsulate transaction activities. Transaction factory is here to implement the Abstract Factory pattern as described in http://homepage.mac.com/loeffler/java/patterns/absfac.html by GoF95 http://homepage.mac.com/loeffler/java/patterns.html. There are different types of transactions. Some may include just the persistance layer, some may include the even the actions executed at some higher layer. This interface provides standard way how to access the transaction abstraction regardless of how the transaction manager is implemented. One may wonder why the TransactionFactory is not part of persistence layer and instead it is in utility package. The reason is that transaction is a logical unit of work which may include other activities than just persisting piece of data. For example sending of a message may be part of transaction. If then the message should be rollbacked, the client needs to have ability to establish transaction, which allows rollbacking of action (of sending data) rather than action of persisting the message.

Version:
$Id: TransactionFactory.java,v 1.6 2007/01/07 06:14:01 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.4 2005/07/28 07:00:46 bastafidli

Method Summary
 javax.transaction.TransactionManager getTransactionManager()
          Get transaction manager for this factory.
 javax.transaction.UserTransaction requestTransaction()
          Get transaction object which we can use to begin/commit/rollback transactions.
 void reset()
          This method is here mainly for testing and it should reset the transaction manager to initial status to that tests can start from known environment instead of being influenced by other tests.
 void stop()
          Stop the transaction factory.
 

Method Detail

requestTransaction

javax.transaction.UserTransaction requestTransaction()
                                                     throws OSSException
Get transaction object which we can use to begin/commit/rollback transactions. This operation is valid only if the transaction factory support explicit transaction across multiple connections.

Returns:
UserTransaction - null if explicit transactions are not supported.
Throws:
OSSException - - an error has occured

getTransactionManager

javax.transaction.TransactionManager getTransactionManager()
Get transaction manager for this factory.

Returns:
TransactionManager

reset

void reset()
           throws OSSException
This method is here mainly for testing and it should reset the transaction manager to initial status to that tests can start from known environment instead of being influenced by other tests.

Throws:
OSSException - - an error has occured during reset

stop

void stop()
          throws OSSException
Stop the transaction factory.

Throws:
OSSException - - problem stoping transaction factory.


Copyright © 2003 - 2006 OpenSubsystems s.r.o.