i3.dragos.core.services.transactions
Interface TransactionManager

All Known Implementing Classes:
LocalTransactionManager

public interface TransactionManager

The TransactionManager creates and manages transactions.

Please refer to the "Guide to Transactions" in the documentation for more information.

Because TransactionManagers are instantiated through reflection, there is an additional requirement beyond implementing the methods in this interface: Every TransactionManager must provide a public constructor that takes a DataSourceURL[] array as its only argument. This will be used to pass the DataSourceURL(s) of the graph pool(s) to manage. If the implementation can not handle the type of data source, or is not capable of distributed transactions, it must throw a TransactionManagerException.

Author:
Ernest Hammerschmidt <ernest@i3.informatik.rwth-aachen.de>, Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>

Method Summary
 Transaction createTransaction()
          Creates a Transaction object for the specific implementation.
 Transaction getCurrentTransaction()
          Gets the currently active Transaction, if any.
 java.util.Collection<DataSourceURL> getManagedDataSources()
          Returns a Collection of DataSourceURLs for all GraphPools managed by this TransactionManager.
 Transaction requestTransaction()
          Gets the currently active Transaction or initializes a new one if none is currently active.
 

Method Detail

getManagedDataSources

java.util.Collection<DataSourceURL> getManagedDataSources()
                                                          throws TransactionException
Returns a Collection of DataSourceURLs for all GraphPools managed by this TransactionManager.

Returns:
a Collection of DataSourceURLs for all GraphPools managed by this TransactionManager.
Throws:
TransactionException - if something goes wrong.

createTransaction

Transaction createTransaction()
                              throws TransactionException
Creates a Transaction object for the specific implementation. If a transaction is already active, this creates either a nested transaction or throws an exception (if nested transactions are not supported).

Returns:
a Transaction instance (never null).
Throws:
TransactionException - if something goes wrong.

getCurrentTransaction

Transaction getCurrentTransaction()
                                  throws TransactionException
Gets the currently active Transaction, if any.

A transaction is considered the current one if it is not in state Transaction.State.PRECOMMIT, Transaction.State.COMMITTED or Transaction.State.ROLLED_BACK, and has no active nested transactions.

Returns:
a Transaction instance or null if none is active at the moment.
Throws:
TransactionException - if something goes wrong.

requestTransaction

Transaction requestTransaction()
                               throws TransactionException
Gets the currently active Transaction or initializes a new one if none is currently active.

This convenience method is a simple combination of getCurrentTransaction() with an optional createTransaction().

Returns:
a Transaction instance (never null).
Throws:
TransactionException - if something goes wrong.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.