1 18 19 package org.apache.activemq.openwire.v2; 20 21 import java.io.DataInput ; 22 import java.io.DataOutput ; 23 import java.io.IOException ; 24 25 import org.apache.activemq.openwire.*; 26 import org.apache.activemq.command.*; 27 28 29 30 41 public class XATransactionIdMarshaller extends TransactionIdMarshaller { 42 43 47 public byte getDataStructureType() { 48 return XATransactionId.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new XATransactionId(); 56 } 57 58 65 public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { 66 super.tightUnmarshal(wireFormat, o, dataIn, bs); 67 68 XATransactionId info = (XATransactionId)o; 69 info.setFormatId(dataIn.readInt()); 70 info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs)); 71 info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs)); 72 73 } 74 75 76 79 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 80 81 XATransactionId info = (XATransactionId)o; 82 83 int rc = super.tightMarshal1(wireFormat, o, bs); 84 rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs); 85 rc += tightMarshalByteArray1(info.getBranchQualifier(), bs); 86 87 return rc + 4; 88 } 89 90 97 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 98 super.tightMarshal2(wireFormat, o, dataOut, bs); 99 100 XATransactionId info = (XATransactionId)o; 101 dataOut.writeInt(info.getFormatId()); 102 tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs); 103 tightMarshalByteArray2(info.getBranchQualifier(), dataOut, bs); 104 105 } 106 107 114 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 115 super.looseUnmarshal(wireFormat, o, dataIn); 116 117 XATransactionId info = (XATransactionId)o; 118 info.setFormatId(dataIn.readInt()); 119 info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn)); 120 info.setBranchQualifier(looseUnmarshalByteArray(dataIn)); 121 122 } 123 124 125 128 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 129 130 XATransactionId info = (XATransactionId)o; 131 132 super.looseMarshal(wireFormat, o, dataOut); 133 dataOut.writeInt(info.getFormatId()); 134 looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut); 135 looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut); 136 137 } 138 } 139 | Popular Tags |