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 ConsumerInfoMarshaller extends BaseCommandMarshaller { 42 43 47 public byte getDataStructureType() { 48 return ConsumerInfo.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new ConsumerInfo(); 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 ConsumerInfo info = (ConsumerInfo)o; 69 info.setConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 70 info.setBrowser(bs.readBoolean()); 71 info.setDestination((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 72 info.setPrefetchSize(dataIn.readInt()); 73 info.setMaximumPendingMessageLimit(dataIn.readInt()); 74 info.setDispatchAsync(bs.readBoolean()); 75 info.setSelector(tightUnmarshalString(dataIn, bs)); 76 info.setSubscriptionName(tightUnmarshalString(dataIn, bs)); 77 info.setNoLocal(bs.readBoolean()); 78 info.setExclusive(bs.readBoolean()); 79 info.setRetroactive(bs.readBoolean()); 80 info.setPriority(dataIn.readByte()); 81 82 if (bs.readBoolean()) { 83 short size = dataIn.readShort(); 84 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 85 for( int i=0; i < size; i++ ) { 86 value[i] = (org.apache.activemq.command.BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 87 } 88 info.setBrokerPath(value); 89 } 90 else { 91 info.setBrokerPath(null); 92 } 93 info.setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); 94 info.setNetworkSubscription(bs.readBoolean()); 95 info.setOptimizedAcknowledge(bs.readBoolean()); 96 info.setNoRangeAcks(bs.readBoolean()); 97 98 } 99 100 101 104 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 105 106 ConsumerInfo info = (ConsumerInfo)o; 107 108 int rc = super.tightMarshal1(wireFormat, o, bs); 109 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs); 110 bs.writeBoolean(info.isBrowser()); 111 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); 112 bs.writeBoolean(info.isDispatchAsync()); 113 rc += tightMarshalString1(info.getSelector(), bs); 114 rc += tightMarshalString1(info.getSubscriptionName(), bs); 115 bs.writeBoolean(info.isNoLocal()); 116 bs.writeBoolean(info.isExclusive()); 117 bs.writeBoolean(info.isRetroactive()); 118 rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); 119 rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getAdditionalPredicate(), bs); 120 bs.writeBoolean(info.isNetworkSubscription()); 121 bs.writeBoolean(info.isOptimizedAcknowledge()); 122 bs.writeBoolean(info.isNoRangeAcks()); 123 124 return rc + 9; 125 } 126 127 134 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 135 super.tightMarshal2(wireFormat, o, dataOut, bs); 136 137 ConsumerInfo info = (ConsumerInfo)o; 138 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs); 139 bs.readBoolean(); 140 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); 141 dataOut.writeInt(info.getPrefetchSize()); 142 dataOut.writeInt(info.getMaximumPendingMessageLimit()); 143 bs.readBoolean(); 144 tightMarshalString2(info.getSelector(), dataOut, bs); 145 tightMarshalString2(info.getSubscriptionName(), dataOut, bs); 146 bs.readBoolean(); 147 bs.readBoolean(); 148 bs.readBoolean(); 149 dataOut.writeByte(info.getPriority()); 150 tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); 151 tightMarshalNestedObject2(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut, bs); 152 bs.readBoolean(); 153 bs.readBoolean(); 154 bs.readBoolean(); 155 156 } 157 158 165 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 166 super.looseUnmarshal(wireFormat, o, dataIn); 167 168 ConsumerInfo info = (ConsumerInfo)o; 169 info.setConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 170 info.setBrowser(dataIn.readBoolean()); 171 info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); 172 info.setPrefetchSize(dataIn.readInt()); 173 info.setMaximumPendingMessageLimit(dataIn.readInt()); 174 info.setDispatchAsync(dataIn.readBoolean()); 175 info.setSelector(looseUnmarshalString(dataIn)); 176 info.setSubscriptionName(looseUnmarshalString(dataIn)); 177 info.setNoLocal(dataIn.readBoolean()); 178 info.setExclusive(dataIn.readBoolean()); 179 info.setRetroactive(dataIn.readBoolean()); 180 info.setPriority(dataIn.readByte()); 181 182 if (dataIn.readBoolean()) { 183 short size = dataIn.readShort(); 184 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 185 for( int i=0; i < size; i++ ) { 186 value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); 187 } 188 info.setBrokerPath(value); 189 } 190 else { 191 info.setBrokerPath(null); 192 } 193 info.setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression) looseUnmarsalNestedObject(wireFormat, dataIn)); 194 info.setNetworkSubscription(dataIn.readBoolean()); 195 info.setOptimizedAcknowledge(dataIn.readBoolean()); 196 info.setNoRangeAcks(dataIn.readBoolean()); 197 198 } 199 200 201 204 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 205 206 ConsumerInfo info = (ConsumerInfo)o; 207 208 super.looseMarshal(wireFormat, o, dataOut); 209 looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); 210 dataOut.writeBoolean(info.isBrowser()); 211 looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); 212 dataOut.writeInt(info.getPrefetchSize()); 213 dataOut.writeInt(info.getMaximumPendingMessageLimit()); 214 dataOut.writeBoolean(info.isDispatchAsync()); 215 looseMarshalString(info.getSelector(), dataOut); 216 looseMarshalString(info.getSubscriptionName(), dataOut); 217 dataOut.writeBoolean(info.isNoLocal()); 218 dataOut.writeBoolean(info.isExclusive()); 219 dataOut.writeBoolean(info.isRetroactive()); 220 dataOut.writeByte(info.getPriority()); 221 looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); 222 looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); 223 dataOut.writeBoolean(info.isNetworkSubscription()); 224 dataOut.writeBoolean(info.isOptimizedAcknowledge()); 225 dataOut.writeBoolean(info.isNoRangeAcks()); 226 227 } 228 } 229 | Popular Tags |