ca.idms.xa
Class IdmsXid

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.io.NativeObject
          extended by ca.idms.io.NativeBase
              extended by ca.idms.xa.IdmsXid
All Implemented Interfaces:
Native, Trace, javax.transaction.xa.Xid

public class IdmsXid
extends NativeBase
implements javax.transaction.xa.Xid

CA IDMS Xid implementation. An IdmsXid contains logic to write itself to a NativeDataOutputStream and read itself from a NativeDataInputStream. An IdmsXid is constructed from the Xid passed by the XA transaction and used to send the native format XID to IDMS. Native format XIDs returned by IDMS for recover requests are used to construct IdmsXid objects which are passed to the XA transaction manager.

Native format (32 bit long, 8 bit char), from xa.h:

 struct xid_t {
  long formatID;              // format identifier        
  long gtrid_length;          // value from 1 through 64  
  long bqual_length;          // value from 1 through 64  
  char data[128];
 } 

Since:
CA IDMS Server 16.0
Version:
16.00 11/29/04

Field Summary
static int LENGTH
          Max length of the XID
 
Fields inherited from class ca.idms.io.NativeBase
options, READ_BOTH, SET_LENGTH
 
Fields inherited from class ca.idms.io.NativeObject
buffer, length, offset
 
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.Xid
MAXBQUALSIZE, MAXGTRIDSIZE
 
Constructor Summary
IdmsXid()
          Creates an object to read a Native XID.
IdmsXid(int len)
          Creates an object to read and write a Native XID buffer.
IdmsXid(javax.transaction.xa.Xid xid)
          Creates an object to write a Native XID.
 
Method Summary
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.
 byte[] getBranchQualifier()
           
 int getFormatId()
           
 byte[] getGlobalTransactionId()
           
 int length(NativeFormat fmt)
          Computes the size of the native form of the object.
 void readNative(NativeDataInputStream in)
          Reads data from an input stream, interpreted as an XID.
 java.lang.String toString()
           
 void writeNative(NativeDataOutputStream out)
          Writes the contents of this object to an output stream in the native XID format.
 
Methods inherited from class ca.idms.io.NativeBase
getOptions, length, readBuffer, setOptions, writeBuffer
 
Methods inherited from class ca.idms.io.NativeObject
getBuffer, getClient, getOffset, length, snap
 
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, 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, wait, wait, wait
 

Field Detail

LENGTH

public static final int LENGTH
Max length of the XID

See Also:
Constant Field Values
Constructor Detail

IdmsXid

public IdmsXid()
Creates an object to read a Native XID.


IdmsXid

public IdmsXid(javax.transaction.xa.Xid xid)
Creates an object to write a Native XID.

Parameters:
xid - XID from transaction manager

IdmsXid

public IdmsXid(int len)
Creates an object to read and write a Native XID buffer. Used within the JDBC Proxy server only.

Parameters:
len - buffer length
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 NativeObject
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()

getFormatId

public int getFormatId()
Specified by:
getFormatId in interface javax.transaction.xa.Xid
Returns:
format ID for the internal or referenced XID

getGlobalTransactionId

public byte[] getGlobalTransactionId()
Specified by:
getGlobalTransactionId in interface javax.transaction.xa.Xid
Returns:
global ID for the internal or referenced XID

getBranchQualifier

public byte[] getBranchQualifier()
Specified by:
getBranchQualifier in interface javax.transaction.xa.Xid
Returns:
branch ID for the internal or referenced XID

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
representation of the internal or referenced XID

length

public int length(NativeFormat fmt)
Computes the size of the native form of the object.

Specified by:
length in interface Native
Overrides:
length in class NativeObject
Parameters:
fmt - the NativeFormat object or null.
Returns:
length in bytes.
See Also:
NativeBase.length(ca.idms.io.NativeFormat, int, int, int)

readNative

public void readNative(NativeDataInputStream in)
                throws java.io.IOException
Reads data from an input stream, interpreted as an XID.

Specified by:
readNative in interface Native
Overrides:
readNative in class NativeObject
Parameters:
in - the native buffered input stream.
Throws:
java.io.IOException - if an IO error occurs

writeNative

public void writeNative(NativeDataOutputStream out)
                 throws java.io.IOException
Writes the contents of this object to an output stream in the native XID format.

Specified by:
writeNative in interface Native
Overrides:
writeNative in class NativeObject
Parameters:
out - the native buffered output stream.
Throws:
java.io.IOException - if an IO error occurs


Copyright © 2009 CA, All rights reserved