1 18 19 package org.apache.activemq.openwire.v3; 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 ProducerInfoMarshaller extends BaseCommandMarshaller { 42 43 47 public byte getDataStructureType() { 48 return ProducerInfo.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new ProducerInfo(); 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 ProducerInfo info = (ProducerInfo)o; 69 info.setProducerId((org.apache.activemq.command.ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 70 info.setDestination((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 71 72 if (bs.readBoolean()) { 73 short size = dataIn.readShort(); 74 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 75 for( int i=0; i < size; i++ ) { 76 value[i] = (org.apache.activemq.command.BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 77 } 78 info.setBrokerPath(value); 79 } 80 else { 81 info.setBrokerPath(null); 82 } 83 info.setDispatchAsync(bs.readBoolean()); 84 info.setWindowSize(dataIn.readInt()); 85 86 } 87 88 89 92 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 93 94 ProducerInfo info = (ProducerInfo)o; 95 96 int rc = super.tightMarshal1(wireFormat, o, bs); 97 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getProducerId(), bs); 98 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); 99 rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); 100 bs.writeBoolean(info.isDispatchAsync()); 101 102 return rc + 4; 103 } 104 105 112 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 113 super.tightMarshal2(wireFormat, o, dataOut, bs); 114 115 ProducerInfo info = (ProducerInfo)o; 116 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getProducerId(), dataOut, bs); 117 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); 118 tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); 119 bs.readBoolean(); 120 dataOut.writeInt(info.getWindowSize()); 121 122 } 123 124 131 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 132 super.looseUnmarshal(wireFormat, o, dataIn); 133 134 ProducerInfo info = (ProducerInfo)o; 135 info.setProducerId((org.apache.activemq.command.ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 136 info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); 137 138 if (dataIn.readBoolean()) { 139 short size = dataIn.readShort(); 140 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 141 for( int i=0; i < size; i++ ) { 142 value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); 143 } 144 info.setBrokerPath(value); 145 } 146 else { 147 info.setBrokerPath(null); 148 } 149 info.setDispatchAsync(dataIn.readBoolean()); 150 info.setWindowSize(dataIn.readInt()); 151 152 } 153 154 155 158 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 159 160 ProducerInfo info = (ProducerInfo)o; 161 162 super.looseMarshal(wireFormat, o, dataOut); 163 looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut); 164 looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); 165 looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); 166 dataOut.writeBoolean(info.isDispatchAsync()); 167 dataOut.writeInt(info.getWindowSize()); 168 169 } 170 } 171 | Popular Tags |