1 21 22 25 26 package org.apache.derby.impl.drda; 27 import javax.transaction.xa.Xid ; 28 29 class DRDAXid implements Xid 30 { 31 32 private final int format_id; 33 private final byte[] global_id; 34 private final byte[] branch_id; 35 36 37 DRDAXid(int formatid, byte[] globalid, byte[] branchid) 38 { 39 40 format_id = formatid; 41 global_id = globalid; 42 branch_id = branchid; 43 44 } 45 46 52 public int getFormatId() 53 { 54 return(format_id); 55 } 56 57 64 public byte[] getGlobalTransactionId() 65 { 66 return(global_id); 67 } 68 69 75 public byte[] getBranchQualifier() 76 { 77 return(branch_id); 78 } 79 80 public String toString() 81 { 82 83 String s = "{DRDAXid: " + 84 "formatId(" + format_id + "), " + 85 "globalTransactionId(" + convertToHexString(global_id) + ")" + 86 "branchQualifier(" + convertToHexString(branch_id) + ")"; 87 return s; 88 } 89 90 91 97 private static String convertToHexString(byte [] buf) 98 { 99 if (buf == null) 100 return null; 101 StringBuffer str = new StringBuffer (); 102 str.append("0x"); 103 String val; 104 int byteVal; 105 for (int i = 0; i < buf.length; i++) 106 { 107 byteVal = buf[i] & 0xff; 108 val = Integer.toHexString(byteVal); 109 if (val.length() < 2) 110 str.append("0"); 111 str.append(val); 112 } 113 return str.toString(); 114 } 115 } 116 117 118 119 120 121 122 123 124 125 | Popular Tags |