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