tyrex.tm

Class TransactionDomain

public abstract class TransactionDomain extends Object

A transaction domain provides centralized management for transactions.

A transaction domain defines the policy for all transactions created from that domain, such as default timeout, maximum number of open transactions, IIOP support, and journaling. In addition, the domain maintains resource managers such as JDBC data sources and JCA connectors.

The application server obtains a transaction manager or user transaction object, and managed resources from the transaction domain.

Transaction domains are created from a domain configuration file. For more information about domain configuration files, refer to the relevant documentation and domain.xsd.

A newly created transaction domain is in the state READY. The recover method must be called in order to make it active (ACTIVE). The domain can be deactivated by calling terminate.

Version: $Revision: 1.24 $ $Date: 2004/04/30 06:35:00 $

Author: Assaf Arkin

Field Summary
static intACTIVE
Domain active status.
static intREADY
Domain ready status.
static intRECOVERING
Domain recovery status.
static intTERMINATED
Domain terminated status.
Method Summary
abstract voidaddInterceptor(TransactionInterceptor interceptor)
Adds a transaction interceptor to this transaction domain.
static TransactionDomaincreateDomain(String url)
Creates a new transaction domain from the specified domain configuration file.
static TransactionDomaincreateDomain(InputStream stream)
Creates a new transaction domain from the specified domain configuration file.
static TransactionDomaincreateDomain(InputSource source)
Creates a new transaction domain from the specified domain configuration file.
static TransactionDomaingetDomain(String name)
Returns a transaction domain with the specified name.
abstract DomainMetricsgetDomainMetrics()
Returns the transaction domain metrics.
abstract StringgetDomainName()
Returns the transaction domain name.
abstract ResourcesgetResources()
Returns resources installed for this transaction domain.
abstract intgetState()
Returns the transaction domain state.
static TransactiongetTransaction(Xid xid)
Returns a transaction based on the transaction identifier.
static TransactiongetTransaction(String xid)
Returns a transaction based on the transaction identifier.
abstract TransactionFactorygetTransactionFactory()
Returns an OTS transaction factory for this transaction domain.
abstract TransactionManagergetTransactionManager()
Returns a transaction manager for this transaction domain.
abstract UserTransactiongetUserTransaction()
Returns a user transaction for this transaction domain.
abstract voidrecover()
Called to initiate recovery.
abstract voidremoveInterceptor(TransactionInterceptor interceptor)
Removes a transaction interceptor to this transaction domain.
abstract voidterminate()
Terminates the transaction domain.

Field Detail

ACTIVE

public static final int ACTIVE
Domain active status. This status is reported for a transaction domain after it has been recovered and before it is terminated. The domain can be used to create and import new transactions.

READY

public static final int READY
Domain ready status. This status is reported for a newly created transaction domain that has not been recovered yet. The domain cannot be used to create or import new transactions until is has been recovered.

RECOVERING

public static final int RECOVERING
Domain recovery status. This status is reported for a transaction domain during recovery.

TERMINATED

public static final int TERMINATED
Domain terminated status. This status is reported for a transaction domain after it has been terminated. The domain is no longer useable.

Method Detail

addInterceptor

public abstract void addInterceptor(TransactionInterceptor interceptor)
Adds a transaction interceptor to this transaction domain. The interceptor will be notified of all transactional activities within this domain.

Parameters: interceptor The transaction interceptor

createDomain

public static TransactionDomain createDomain(String url)
Creates a new transaction domain from the specified domain configuration file.

This method throws an exception if a transaction domain with the same name already exists, or the transaction domain could not be created.

Parameters: url URL for the transaction domain configuration file

Returns: A new transaction domain

UNKNOWN: DomainConfigurationException An error occured while attempting to create the domain, or a transaction domain with the same name already exists

createDomain

public static TransactionDomain createDomain(InputStream stream)
Creates a new transaction domain from the specified domain configuration file.

This method throws an exception if a transaction domain with the same name already exists, or the transaction domain could not be created.

Parameters: steam Input stream for the transaction domain configuration file

Returns: A new transaction domain

UNKNOWN: DomainConfigurationException An error occured while attempting to create the domain, or a transaction domain with the same name already exists

createDomain

public static TransactionDomain createDomain(InputSource source)
Creates a new transaction domain from the specified domain configuration file.

This method throws an exception if a transaction domain with the same name already exists, or the transaction domain could not be created.

Parameters: source SAX input source for the transaction domain configuration file

Returns: A new transaction domain

UNKNOWN: DomainConfigurationException An error occured while attempting to create the domain, or a transaction domain with the same name already exists

getDomain

public static TransactionDomain getDomain(String name)
Returns a transaction domain with the specified name. Returns null if no transaction domain with that name was created.

Parameters: name The name of the transaction domain

Returns: The transaction domain, or if no such domain

getDomainMetrics

public abstract DomainMetrics getDomainMetrics()
Returns the transaction domain metrics.

Returns: The transaction domain metrics

getDomainName

public abstract String getDomainName()
Returns the transaction domain name.

Returns: The transaction domain name

getResources

public abstract Resources getResources()
Returns resources installed for this transaction domain.

Initially the resource list is based on resources defined in the domain configuration file. This method can be used to add new resources or disable existing resources.

Returns: Resources installed for this transaction domain

getState

public abstract int getState()
Returns the transaction domain state.

The initial state for a transaction domain is READY. The domain transitions to ACTIVE after recovery has completed by calling recover.

The domain transitions to TERMINATED after it has been terminated by calling terminate.

Returns: The transaction domain state

getTransaction

public static Transaction getTransaction(Xid xid)
Returns a transaction based on the transaction identifier.

Returns the transaction object is the transaction is known to any transaction domain. The transaction may be in the prepared or complete state.

Parameters: xid The transaction identifier

Returns: The transaction, or null if no such transaction exists

getTransaction

public static Transaction getTransaction(String xid)
Returns a transaction based on the transaction identifier.

Returns the transaction object is the transaction is known to any transaction domain. The transaction may be in the prepared or complete state.

The transaction identifier is a string obtained by calling toString() on the transaction or Xid object.

Parameters: xid The transaction identifier

Returns: The transaction, or null if no such transaction exists

getTransactionFactory

public abstract TransactionFactory getTransactionFactory()
Returns an OTS transaction factory for this transaction domain.

The transaction factory can be used to create and re-create OTS transactions in this domain only. It is also used to identify the ORB by implementing TransactionService.

Calling this method multiple times will return the same instance of the transaction factory.

Returns: The transaction factory for this domain

getTransactionManager

public abstract TransactionManager getTransactionManager()
Returns a transaction manager for this transaction domain.

The transaction managed can be used to begin, commit and rollback transactions in this domain only.

Calling this method multiple times will return the same instance of the transaction manager.

Returns: The transaction manager for this domain

getUserTransaction

public abstract UserTransaction getUserTransaction()
Returns a user transaction for this transaction domain.

The user transaction can be used to begin, commit and rollback transactions in this domain only.

Calling this method multiple times will return the same instance of the user transaction.

Returns: The user transaction for this domain

recover

public abstract void recover()
Called to initiate recovery. This method must be called before the transaction domain is active and can be used to create new transactions. This method may be called multiple times, but will initiate recovery only the first time.

Throws: RecoveryException A chain of errors reported during recovery

removeInterceptor

public abstract void removeInterceptor(TransactionInterceptor interceptor)
Removes a transaction interceptor to this transaction domain.

Parameters: interceptor The transaction interceptor

terminate

public abstract void terminate()
Terminates the transaction domain. After this method returns, the transaction manager is no longer able to begin new transactions in this domain.
Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.