org.objectweb.jotm.jtests.conform
Class XAObject

java.lang.Object
  |
  +--org.objectweb.jotm.jtests.conform.XAObject
All Implemented Interfaces:
javax.transaction.xa.XAResource
Direct Known Subclasses:
XABoolean, XAInteger

public class XAObject
extends Object
implements javax.transaction.xa.XAResource

An object that supports the 2-PC XA protocol Created on Oct 15, 2001

Author:
Christophe Ney

Field Summary
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
XAObject(Object value, boolean failOnCommit)
          Creates new XAObject
 
Method Summary
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
          Commit the global transaction specified by xid.
 void end(javax.transaction.xa.Xid xid, int flags)
          Ends the work performed on behalf of a transaction branch.
 void forget(javax.transaction.xa.Xid xid)
          Tell the resource manager to forget about a heuristically completed transaction branch.
 Object getCurrentValue()
          is the current value set to true
 Object getPersistentValue()
          is the persistent value set to true
 int getTransactionTimeout()
          Getter for property transactionTimeout.
 boolean isDirty()
          is the object dirty.
 boolean isSameRM(javax.transaction.xa.XAResource xares)
          Determine if the resource manager instance represented by the target object is the same as the resource manager instance represented by the parameter xares
 int prepare(javax.transaction.xa.Xid xid)
          Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
 javax.transaction.xa.Xid[] recover(int flag)
          Obtain a list of prepared transaction branches from a resource manager.
 void rollback(javax.transaction.xa.Xid xid)
          Inform the resource manager to roll back work done on behalf of a transaction branch rollback is performed after end is called
 void setCurrentValue(Object value)
          Setter for property value.
static void setLogWriter(PrintWriter pw)
           
 boolean setTransactionTimeout(int transactionTimeout)
          Setter for property transactionTimeout.
 void start(javax.transaction.xa.Xid xid, int flags)
           
 String toString()
          Human readable representation of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XAObject

public XAObject(Object value,
                boolean failOnCommit)
Creates new XAObject

Parameters:
value - the original value of the boolean
Method Detail

setLogWriter

public static void setLogWriter(PrintWriter pw)

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Inform the resource manager to roll back work done on behalf of a transaction branch rollback is performed after end is called

Specified by:
rollback in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Commit the global transaction specified by xid. commit is performed after end is called

Specified by:
commit in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Tell the resource manager to forget about a heuristically completed transaction branch. NOT IMPLEMENTED

Specified by:
forget in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int flag)
                                   throws javax.transaction.xa.XAException
Obtain a list of prepared transaction branches from a resource manager. NOT IMPLEMENTED

Specified by:
recover in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xares)
                 throws javax.transaction.xa.XAException
Determine if the resource manager instance represented by the target object is the same as the resource manager instance represented by the parameter xares

Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Parameters:
xares - An XAResource object
Returns:
true if same RM instance, otherwise false.
javax.transaction.xa.XAException

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.

Specified by:
prepare in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Specified by:
start in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Ends the work performed on behalf of a transaction branch.

Specified by:
end in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Getter for property transactionTimeout.

Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Returns:
Value of property transactionTimeout.
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int transactionTimeout)
                              throws javax.transaction.xa.XAException
Setter for property transactionTimeout.

Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Parameters:
transactionTimeout - New value of property transactionTimeout.
javax.transaction.xa.XAException

setCurrentValue

public void setCurrentValue(Object value)
                     throws javax.transaction.xa.XAException
Setter for property value.

Parameters:
value - New value of property value.
javax.transaction.xa.XAException

toString

public String toString()
Human readable representation of the object

Overrides:
toString in class Object

getPersistentValue

public Object getPersistentValue()
is the persistent value set to true


getCurrentValue

public Object getCurrentValue()
                       throws javax.transaction.xa.XAException
is the current value set to true

javax.transaction.xa.XAException

isDirty

public boolean isDirty()
                throws javax.transaction.xa.XAException
is the object dirty. (persistent != current)

javax.transaction.xa.XAException