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