tyrex.tm
Class TransactionDomain

java.lang.Object
  extended bytyrex.tm.TransactionDomain

public abstract class TransactionDomain
extends java.lang.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 int ACTIVE
          Domain active status.
static int READY
          Domain ready status.
static int RECOVERING
          Domain recovery status.
static int TERMINATED
          Domain terminated status.
 
Constructor Summary
TransactionDomain()
           
 
Method Summary
abstract  void addInterceptor(TransactionInterceptor interceptor)
          Adds a transaction interceptor to this transaction domain.
static TransactionDomain createDomain(org.xml.sax.InputSource source)
          Creates a new transaction domain from the specified domain configuration file.
static TransactionDomain createDomain(java.io.InputStream stream)
          Creates a new transaction domain from the specified domain configuration file.
static TransactionDomain createDomain(java.lang.String url)
          Creates a new transaction domain from the specified domain configuration file.
static TransactionDomain getDomain(java.lang.String name)
          Returns a transaction domain with the specified name.
abstract  DomainMetrics getDomainMetrics()
          Returns the transaction domain metrics.
abstract  java.lang.String getDomainName()
          Returns the transaction domain name.
abstract  Resources getResources()
          Returns resources installed for this transaction domain.
abstract  int getState()
          Returns the transaction domain state.
static javax.transaction.Transaction getTransaction(java.lang.String xid)
          Returns a transaction based on the transaction identifier.
static javax.transaction.Transaction getTransaction(javax.transaction.xa.Xid xid)
          Returns a transaction based on the transaction identifier.
abstract  org.omg.CosTransactions.TransactionFactory getTransactionFactory()
          Returns an OTS transaction factory for this transaction domain.
abstract  javax.transaction.TransactionManager getTransactionManager()
          Returns a transaction manager for this transaction domain.
abstract  javax.transaction.UserTransaction getUserTransaction()
          Returns a user transaction for this transaction domain.
abstract  void recover()
          Called to initiate recovery.
abstract  void removeInterceptor(TransactionInterceptor interceptor)
          Removes a transaction interceptor to this transaction domain.
abstract  void terminate()
          Terminates the transaction domain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

See Also:
Constant Field Values

RECOVERING

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

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values
Constructor Detail

TransactionDomain

public TransactionDomain()
Method Detail

getDomain

public static TransactionDomain getDomain(java.lang.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

createDomain

public static TransactionDomain createDomain(java.lang.String url)
                                      throws DomainConfigurationException
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
Throws:
DomainConfigurationException

createDomain

public static TransactionDomain createDomain(java.io.InputStream stream)
                                      throws DomainConfigurationException
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.

Returns:
A new transaction domain
Throws:
DomainConfigurationException

createDomain

public static TransactionDomain createDomain(org.xml.sax.InputSource source)
                                      throws DomainConfigurationException
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
Throws:
DomainConfigurationException

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

recover

public abstract void recover()
                      throws RecoveryException
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

getTransaction

public static javax.transaction.Transaction getTransaction(javax.transaction.xa.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 javax.transaction.Transaction getTransaction(java.lang.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

getTransactionManager

public abstract javax.transaction.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 javax.transaction.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

getTransactionFactory

public abstract org.omg.CosTransactions.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

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

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.


getDomainMetrics

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

Returns:
The transaction domain metrics

getDomainName

public abstract java.lang.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


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.