BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.transaction
Class TxHelper

java.lang.Object
  |
  +--weblogic.transaction.TxHelper

public class TxHelper
extends java.lang.Object

This class is a convenience wrapper for gaining access to objects and resources related to the transaction manager, on both client and server processes, via static methods. Some of these methods are deprecated and TransactionHelper should be used instead.

Author:
Copyright © 2004 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
TxHelper()
           
 
Method Summary
static javax.transaction.xa.Xid createXid(byte[] aGlobalTransactionId, byte[] aBranchQualifier)
          Create an Xid object, assuming global transaction identifier is in internal format of weblogic's transaction manager.
static javax.transaction.xa.Xid createXid(int aFormatId, byte[] aGlobalTransactionId, byte[] aBranchQualifier)
          Create an Xid object, given its public attributes.
static InterposedTransactionManager getClientInterposedTransactionManager(javax.naming.Context initialContext, java.lang.String serverName)
          Client-side gateway implementors should use this method to obtain the InterposedTransactionManager interface of the Client transaction manager that corresponds to a particular server's transaction manager to import foreign transactions into WLS.
static ClientTransactionManager getClientTransactionManager()
          Deprecated.  
static InterposedTransactionManager getServerInterposedTransactionManager()
          Server-side gateway implementors should use this method to obtain the InterposedTransactionManager interface of the local singleton Server transaction manager to import foreign transactions into WLS.
static Transaction getTransaction()
          Deprecated.  
static TransactionManager getTransactionManager()
          Gets a reference to the singleton, server-side TransactionManager object.
static javax.transaction.UserTransaction getUserTransaction()
          Deprecated.  
static java.lang.String status2String(int status)
          Translates javax.transaction.Status constants to English strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TxHelper

public TxHelper()
Method Detail

getTransaction

public static Transaction getTransaction()
Deprecated.  

See Also:
TransactionHelper.getTransaction()

getUserTransaction

public static javax.transaction.UserTransaction getUserTransaction()
Deprecated.  

See Also:
TransactionHelper.getUserTransaction()

getTransactionManager

public static TransactionManager getTransactionManager()
Gets a reference to the singleton, server-side TransactionManager object. Callers expecting consistent behavior between server, fat-client and thin-client should use ClientTransactionManager via TransactionHelper.

See Also:
TransactionHelper.getTransactionManager()

getClientTransactionManager

public static ClientTransactionManager getClientTransactionManager()
Deprecated.  

See Also:
TransactionHelper.getTransactionManager()

getServerInterposedTransactionManager

public static InterposedTransactionManager getServerInterposedTransactionManager()
Server-side gateway implementors should use this method to obtain the InterposedTransactionManager interface of the local singleton Server transaction manager to import foreign transactions into WLS. This local singleton Server transaction manager will also internally coordinate all foreign transactions imported through it.

Returns:
The InterposedTransactionManager interface of the singleton Server transaction manager
See Also:
InterposedTransactionManager

getClientInterposedTransactionManager

public static InterposedTransactionManager getClientInterposedTransactionManager(javax.naming.Context initialContext,
                                                                                 java.lang.String serverName)
Client-side gateway implementors should use this method to obtain the InterposedTransactionManager interface of the Client transaction manager that corresponds to a particular server's transaction manager to import foreign transactions into WLS. Foreign transactions imported into WLS through this Client transaction manager will be coordinated by the specified server internally.

If the initial context is obtained from a non-clustered server, then the server name specified should refer to the same server. If the initial context is obtained from a cluster, then the server name specified should refer to a server within the cluster.

Note that this method returns null on any errors. If clients are interested in getting the exceptions thrown when obtaining the InterposedTransactionManager, they could perform JNDI lookup for the following path from the initial context directly: weblogic.transaction.coordinators.

Note that even though it is possible to cast the TransactionManager instance obtained from getTransactionManager to a InterposedTransactionManager instance, but doing so is strongly discouraged. This is because the Client transaction manager singleton instance returned by getTransactionManager may not be associated with any server, and cannot import transactions.

Parameters:
initCtx - The initial context of the client application
serverName - The name of the server
Returns:
The InterposedTransactionManager interface of the Client transaction manager that corresponds to the specified server's transaction manager. Returns null on any error.
See Also:
InterposedTransactionManager

status2String

public static java.lang.String status2String(int status)
Translates javax.transaction.Status constants to English strings.

createXid

public static javax.transaction.xa.Xid createXid(int aFormatId,
                                                 byte[] aGlobalTransactionId,
                                                 byte[] aBranchQualifier)
Create an Xid object, given its public attributes.

Parameters:
aFormatId - Format identifier
aGlobalTransactionId - Global transation identifier
aBranchQualifier - Branch qualifier
Returns:
An Xid object or null

createXid

public static javax.transaction.xa.Xid createXid(byte[] aGlobalTransactionId,
                                                 byte[] aBranchQualifier)
Create an Xid object, assuming global transaction identifier is in internal format of weblogic's transaction manager.

Parameters:
aGlobalTransactionId - Global transation identifier
aBranchQualifier - Branch qualifier (optional)
Returns:
An Xid object or null

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81