ca.idms.xa
Class IdmsXAResource

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.xa.IdmsXAResource
All Implemented Interfaces:
Trace, javax.transaction.xa.XAResource

public class IdmsXAResource
extends TraceObject
implements javax.transaction.xa.XAResource

Represents an IDMS connection to an XA Transaction Manager.

Version:
1.00, 12/04/04
Author:
Dave Ross
See Also:
IdmsXAConnection

Field Summary
static java.lang.String COUNT
          Property name to set internal recover count.
 
Fields inherited from class ca.idms.io.TraceObject
exclude, EXCLUDE, FALSE, include, INCLUDE, logWriter, PREFIX, PROPERTIES_FILE, PROPERTIES_KEY, snap, SNAP, SNAP_BYTES, SNAP_NATIVE, SNAP_OBJECT, SNAP_SQL, snapBytes, snapNative, snapObject, snapSql, stub, trace, TRACE, TRACE_FILE, TRACE_LIFE, TRACE_NATIVE, TRACE_PRODUCT, traceLife, traceNative, traceStream, TRUE
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
IdmsXAResource(ca.idms.dsi.Node node, ca.idms.xa.IdmsXAListener listener)
          Creates an XA object for an IDMS resource manager.
 
Method Summary
 void close()
          Marks this XAResource as physically disconnected.
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
          Commits the transaction branch.
 void end(javax.transaction.xa.Xid xid, int flags)
          Delists the connection from the global transaction.
 void forget(javax.transaction.xa.Xid xid)
          Forgets about the transaction branch.
protected  java.lang.Object get(java.lang.reflect.Field f)
          Overrides the default get method to allow the default snap method access to the value of a non-public variable.
 int getTransactionTimeout()
          Gets the transaction timeout.
 boolean isSameRM(javax.transaction.xa.XAResource xar)
           
 int prepare(javax.transaction.xa.Xid xid)
          Prepares the connection to COMMIT.
 javax.transaction.xa.Xid[] recover(int flags)
          Gets a list of in doubt transactions from IDMS.
 void rollback(javax.transaction.xa.Xid xid)
          Rolls the transaction branch back.
 boolean setTransactionTimeout(int t)
          Sets the transaction timeout.
 void start(javax.transaction.xa.Xid xid, int flags)
          Enlists the connection in the global transaction.
 
Methods inherited from class ca.idms.io.TraceObject
finalize, getBoolean, getClasses, getInteger, getProperty, listProperties, message, parseList, print, print, print, println, println, snap, snap, snap, snap, snap, snap, snap, toHex, toHex, toHex, toHex, toHex, toString, trace, trace, trace, trace, trace, trace, traceEntry, unloadProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNT

public static final java.lang.String COUNT
Property name to set internal recover count.

See Also:
Constant Field Values
Constructor Detail

IdmsXAResource

public IdmsXAResource(ca.idms.dsi.Node node,
                      ca.idms.xa.IdmsXAListener listener)
Creates an XA object for an IDMS resource manager.

Parameters:
node - The DSI physical connection object
listener - The DSI resource manager connection object
Method Detail

get

protected java.lang.Object get(java.lang.reflect.Field f)
                        throws java.lang.IllegalAccessException
Overrides the default get method to allow the default snap method access to the value of a non-public variable.

Overrides:
get in class TraceObject
Parameters:
f - a Field returned by Class.getDeclaredFields
Returns:
the Object named by f
Throws:
java.lang.IllegalAccessException - should not really happen, but Field.get requires it
See Also:
TraceObject.snap, TraceObject.snap()

close

public void close()
Marks this XAResource as physically disconnected. This method terminates the network connection to IDMS. IDMS terminates any SQL sessions still existing with a ROLLBACK RELEASE.

Throws:
SQLException - does not happen.

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Gets the transaction timeout.

Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Returns:
the timeout
Throws:
javax.transaction.xa.XAException - (not really).

setTransactionTimeout

public boolean setTransactionTimeout(int t)
                              throws javax.transaction.xa.XAException
Sets the transaction timeout. This method must be invoked before the start method for an Xid.

Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Parameters:
t - timeout value
Throws:
javax.transaction.xa.XAException - (not really).

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xar)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Returns:
true if connected to the same IDMS system
Throws:
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Enlists the connection in the global transaction.

Specified by:
start in interface javax.transaction.xa.XAResource
Parameters:
xid - The XID from the transaction manager.
flags - Options or 0.
Throws:
javax.transaction.xa.XAException - if an error occurs.

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Delists the connection from the global transaction.

Specified by:
end in interface javax.transaction.xa.XAResource
Parameters:
xid - The XID from the transaction manager.
flags - Options or 0.
Throws:
javax.transaction.xa.XAException - if an error occurs.

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Prepares the connection to COMMIT.

Specified by:
prepare in interface javax.transaction.xa.XAResource
Parameters:
xid - The XID from the transaction manager.
Throws:
javax.transaction.xa.XAException - if an error occurs.

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Commits the transaction branch.

Specified by:
commit in interface javax.transaction.xa.XAResource
Parameters:
xid - The XID from the transaction manager.
onePhase - true to request one phase COMMIT optimization.
Throws:
javax.transaction.xa.XAException - if an error occurs.

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Rolls the transaction branch back.

Specified by:
rollback in interface javax.transaction.xa.XAResource
Parameters:
xid - The XID from the transaction manager.
Throws:
javax.transaction.xa.XAException - if an error occurs.

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Forgets about the transaction branch.

Specified by:
forget in interface javax.transaction.xa.XAResource
Parameters:
xid - The XID from the transaction manager.
Throws:
javax.transaction.xa.XAException - if an error occurs.

recover

public javax.transaction.xa.Xid[] recover(int flags)
                                   throws javax.transaction.xa.XAException
Gets a list of in doubt transactions from IDMS.

Specified by:
recover in interface javax.transaction.xa.XAResource
Parameters:
flags - Recover options.
Returns:
An array of IdmsXid objects.
Throws:
javax.transaction.xa.XAException - if an error occurs.


Copyright © 2009 CA, All rights reserved