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 abstract class MessageMarshaller extends BaseCommandMarshaller { 42 43 50 public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { 51 super.tightUnmarshal(wireFormat, o, dataIn, bs); 52 53 Message info = (Message)o; 54 55 info.beforeUnmarshall(wireFormat); 56 57 info.setProducerId((org.apache.activemq.command.ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 58 info.setDestination((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 59 info.setTransactionId((org.apache.activemq.command.TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 60 info.setOriginalDestination((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 61 info.setMessageId((org.apache.activemq.command.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); 62 info.setOriginalTransactionId((org.apache.activemq.command.TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 63 info.setGroupID(tightUnmarshalString(dataIn, bs)); 64 info.setGroupSequence(dataIn.readInt()); 65 info.setCorrelationId(tightUnmarshalString(dataIn, bs)); 66 info.setPersistent(bs.readBoolean()); 67 info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs)); 68 info.setPriority(dataIn.readByte()); 69 info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); 70 info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs)); 71 info.setType(tightUnmarshalString(dataIn, bs)); 72 info.setContent(tightUnmarshalByteSequence(dataIn, bs)); 73 info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs)); 74 info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); 75 info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 76 info.setCompressed(bs.readBoolean()); 77 info.setRedeliveryCounter(dataIn.readInt()); 78 79 if (bs.readBoolean()) { 80 short size = dataIn.readShort(); 81 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 82 for( int i=0; i < size; i++ ) { 83 value[i] = (org.apache.activemq.command.BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 84 } 85 info.setBrokerPath(value); 86 } 87 else { 88 info.setBrokerPath(null); 89 } 90 info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs)); 91 info.setUserID(tightUnmarshalString(dataIn, bs)); 92 info.setRecievedByDFBridge(bs.readBoolean()); 93 info.setDroppable(bs.readBoolean()); 94 95 info.afterUnmarshall(wireFormat); 96 97 } 98 99 100 103 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 104 105 Message info = (Message)o; 106 107 info.beforeMarshall(wireFormat); 108 109 int rc = super.tightMarshal1(wireFormat, o, bs); 110 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getProducerId(), bs); 111 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); 112 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getTransactionId(), bs); 113 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getOriginalDestination(), bs); 114 rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getMessageId(), bs); 115 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getOriginalTransactionId(), bs); 116 rc += tightMarshalString1(info.getGroupID(), bs); 117 rc += tightMarshalString1(info.getCorrelationId(), bs); 118 bs.writeBoolean(info.isPersistent()); 119 rc+=tightMarshalLong1(wireFormat, info.getExpiration(), bs); 120 rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getReplyTo(), bs); 121 rc+=tightMarshalLong1(wireFormat, info.getTimestamp(), bs); 122 rc += tightMarshalString1(info.getType(), bs); 123 rc += tightMarshalByteSequence1(info.getContent(), bs); 124 rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs); 125 rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getDataStructure(), bs); 126 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getTargetConsumerId(), bs); 127 bs.writeBoolean(info.isCompressed()); 128 rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); 129 rc+=tightMarshalLong1(wireFormat, info.getArrival(), bs); 130 rc += tightMarshalString1(info.getUserID(), bs); 131 bs.writeBoolean(info.isRecievedByDFBridge()); 132 bs.writeBoolean(info.isDroppable()); 133 134 return rc + 9; 135 } 136 137 144 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 145 super.tightMarshal2(wireFormat, o, dataOut, bs); 146 147 Message info = (Message)o; 148 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getProducerId(), dataOut, bs); 149 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); 150 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getTransactionId(), dataOut, bs); 151 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getOriginalDestination(), dataOut, bs); 152 tightMarshalNestedObject2(wireFormat, (DataStructure)info.getMessageId(), dataOut, bs); 153 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getOriginalTransactionId(), dataOut, bs); 154 tightMarshalString2(info.getGroupID(), dataOut, bs); 155 dataOut.writeInt(info.getGroupSequence()); 156 tightMarshalString2(info.getCorrelationId(), dataOut, bs); 157 bs.readBoolean(); 158 tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs); 159 dataOut.writeByte(info.getPriority()); 160 tightMarshalNestedObject2(wireFormat, (DataStructure)info.getReplyTo(), dataOut, bs); 161 tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs); 162 tightMarshalString2(info.getType(), dataOut, bs); 163 tightMarshalByteSequence2(info.getContent(), dataOut, bs); 164 tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs); 165 tightMarshalNestedObject2(wireFormat, (DataStructure)info.getDataStructure(), dataOut, bs); 166 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getTargetConsumerId(), dataOut, bs); 167 bs.readBoolean(); 168 dataOut.writeInt(info.getRedeliveryCounter()); 169 tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); 170 tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs); 171 tightMarshalString2(info.getUserID(), dataOut, bs); 172 bs.readBoolean(); 173 bs.readBoolean(); 174 175 info.afterMarshall(wireFormat); 176 177 } 178 179 186 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 187 super.looseUnmarshal(wireFormat, o, dataIn); 188 189 Message info = (Message)o; 190 191 info.beforeUnmarshall(wireFormat); 192 193 info.setProducerId((org.apache.activemq.command.ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 194 info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); 195 info.setTransactionId((org.apache.activemq.command.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); 196 info.setOriginalDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); 197 info.setMessageId((org.apache.activemq.command.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); 198 info.setOriginalTransactionId((org.apache.activemq.command.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); 199 info.setGroupID(looseUnmarshalString(dataIn)); 200 info.setGroupSequence(dataIn.readInt()); 201 info.setCorrelationId(looseUnmarshalString(dataIn)); 202 info.setPersistent(dataIn.readBoolean()); 203 info.setExpiration(looseUnmarshalLong(wireFormat, dataIn)); 204 info.setPriority(dataIn.readByte()); 205 info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); 206 info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn)); 207 info.setType(looseUnmarshalString(dataIn)); 208 info.setContent(looseUnmarshalByteSequence(dataIn)); 209 info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn)); 210 info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn)); 211 info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 212 info.setCompressed(dataIn.readBoolean()); 213 info.setRedeliveryCounter(dataIn.readInt()); 214 215 if (dataIn.readBoolean()) { 216 short size = dataIn.readShort(); 217 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 218 for( int i=0; i < size; i++ ) { 219 value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); 220 } 221 info.setBrokerPath(value); 222 } 223 else { 224 info.setBrokerPath(null); 225 } 226 info.setArrival(looseUnmarshalLong(wireFormat, dataIn)); 227 info.setUserID(looseUnmarshalString(dataIn)); 228 info.setRecievedByDFBridge(dataIn.readBoolean()); 229 info.setDroppable(dataIn.readBoolean()); 230 231 info.afterUnmarshall(wireFormat); 232 233 } 234 235 236 239 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 240 241 Message info = (Message)o; 242 243 info.beforeMarshall(wireFormat); 244 245 super.looseMarshal(wireFormat, o, dataOut); 246 looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut); 247 looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); 248 looseMarshalCachedObject(wireFormat, (DataStructure)info.getTransactionId(), dataOut); 249 looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalDestination(), dataOut); 250 looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut); 251 looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalTransactionId(), dataOut); 252 looseMarshalString(info.getGroupID(), dataOut); 253 dataOut.writeInt(info.getGroupSequence()); 254 looseMarshalString(info.getCorrelationId(), dataOut); 255 dataOut.writeBoolean(info.isPersistent()); 256 looseMarshalLong(wireFormat, info.getExpiration(), dataOut); 257 dataOut.writeByte(info.getPriority()); 258 looseMarshalNestedObject(wireFormat, (DataStructure)info.getReplyTo(), dataOut); 259 looseMarshalLong(wireFormat, info.getTimestamp(), dataOut); 260 looseMarshalString(info.getType(), dataOut); 261 looseMarshalByteSequence(wireFormat, info.getContent(), dataOut); 262 looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut); 263 looseMarshalNestedObject(wireFormat, (DataStructure)info.getDataStructure(), dataOut); 264 looseMarshalCachedObject(wireFormat, (DataStructure)info.getTargetConsumerId(), dataOut); 265 dataOut.writeBoolean(info.isCompressed()); 266 dataOut.writeInt(info.getRedeliveryCounter()); 267 looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); 268 looseMarshalLong(wireFormat, info.getArrival(), dataOut); 269 looseMarshalString(info.getUserID(), dataOut); 270 dataOut.writeBoolean(info.isRecievedByDFBridge()); 271 dataOut.writeBoolean(info.isDroppable()); 272 273 } 274 } 275 | Popular Tags |