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 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 85 } 86 87 88 91 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 92 93 ProducerInfo info = (ProducerInfo)o; 94 95 int rc = super.tightMarshal1(wireFormat, o, bs); 96 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getProducerId(), bs); 97 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); 98 rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); 99 bs.writeBoolean(info.isDispatchAsync()); 100 101 return rc + 0; 102 } 103 104 111 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 112 super.tightMarshal2(wireFormat, o, dataOut, bs); 113 114 ProducerInfo info = (ProducerInfo)o; 115 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getProducerId(), dataOut, bs); 116 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); 117 tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); 118 bs.readBoolean(); 119 120 } 121 122 129 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 130 super.looseUnmarshal(wireFormat, o, dataIn); 131 132 ProducerInfo info = (ProducerInfo)o; 133 info.setProducerId((org.apache.activemq.command.ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 134 info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); 135 136 if (dataIn.readBoolean()) { 137 short size = dataIn.readShort(); 138 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 139 for( int i=0; i < size; i++ ) { 140 value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); 141 } 142 info.setBrokerPath(value); 143 } 144 else { 145 info.setBrokerPath(null); 146 } 147 info.setDispatchAsync(dataIn.readBoolean()); 148 149 } 150 151 152 155 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 156 157 ProducerInfo info = (ProducerInfo)o; 158 159 super.looseMarshal(wireFormat, o, dataOut); 160 looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut); 161 looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); 162 looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); 163 dataOut.writeBoolean(info.isDispatchAsync()); 164 165 } 166 } 167 | Popular Tags |