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 class BrokerInfoMarshaller extends BaseCommandMarshaller { 42 43 47 public byte getDataStructureType() { 48 return BrokerInfo.DATA_STRUCTURE_TYPE; 49 } 50 51 54 public DataStructure createObject() { 55 return new BrokerInfo(); 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 BrokerInfo info = (BrokerInfo)o; 69 info.setBrokerId((org.apache.activemq.command.BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 70 info.setBrokerURL(tightUnmarshalString(dataIn, bs)); 71 72 if (bs.readBoolean()) { 73 short size = dataIn.readShort(); 74 org.apache.activemq.command.BrokerInfo value[] = new org.apache.activemq.command.BrokerInfo[size]; 75 for( int i=0; i < size; i++ ) { 76 value[i] = (org.apache.activemq.command.BrokerInfo) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 77 } 78 info.setPeerBrokerInfos(value); 79 } 80 else { 81 info.setPeerBrokerInfos(null); 82 } 83 info.setBrokerName(tightUnmarshalString(dataIn, bs)); 84 info.setSlaveBroker(bs.readBoolean()); 85 info.setMasterBroker(bs.readBoolean()); 86 info.setFaultTolerantConfiguration(bs.readBoolean()); 87 info.setDuplexConnection(bs.readBoolean()); 88 info.setNetworkConnection(bs.readBoolean()); 89 info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs)); 90 info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs)); 91 info.setNetworkProperties(tightUnmarshalString(dataIn, bs)); 92 93 } 94 95 96 99 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 100 101 BrokerInfo info = (BrokerInfo)o; 102 103 int rc = super.tightMarshal1(wireFormat, o, bs); 104 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getBrokerId(), bs); 105 rc += tightMarshalString1(info.getBrokerURL(), bs); 106 rc += tightMarshalObjectArray1(wireFormat, info.getPeerBrokerInfos(), bs); 107 rc += tightMarshalString1(info.getBrokerName(), bs); 108 bs.writeBoolean(info.isSlaveBroker()); 109 bs.writeBoolean(info.isMasterBroker()); 110 bs.writeBoolean(info.isFaultTolerantConfiguration()); 111 bs.writeBoolean(info.isDuplexConnection()); 112 bs.writeBoolean(info.isNetworkConnection()); 113 rc+=tightMarshalLong1(wireFormat, info.getConnectionId(), bs); 114 rc += tightMarshalString1(info.getBrokerUploadUrl(), bs); 115 rc += tightMarshalString1(info.getNetworkProperties(), bs); 116 117 return rc + 0; 118 } 119 120 127 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 128 super.tightMarshal2(wireFormat, o, dataOut, bs); 129 130 BrokerInfo info = (BrokerInfo)o; 131 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getBrokerId(), dataOut, bs); 132 tightMarshalString2(info.getBrokerURL(), dataOut, bs); 133 tightMarshalObjectArray2(wireFormat, info.getPeerBrokerInfos(), dataOut, bs); 134 tightMarshalString2(info.getBrokerName(), dataOut, bs); 135 bs.readBoolean(); 136 bs.readBoolean(); 137 bs.readBoolean(); 138 bs.readBoolean(); 139 bs.readBoolean(); 140 tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs); 141 tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs); 142 tightMarshalString2(info.getNetworkProperties(), dataOut, bs); 143 144 } 145 146 153 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 154 super.looseUnmarshal(wireFormat, o, dataIn); 155 156 BrokerInfo info = (BrokerInfo)o; 157 info.setBrokerId((org.apache.activemq.command.BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 158 info.setBrokerURL(looseUnmarshalString(dataIn)); 159 160 if (dataIn.readBoolean()) { 161 short size = dataIn.readShort(); 162 org.apache.activemq.command.BrokerInfo value[] = new org.apache.activemq.command.BrokerInfo[size]; 163 for( int i=0; i < size; i++ ) { 164 value[i] = (org.apache.activemq.command.BrokerInfo) looseUnmarsalNestedObject(wireFormat,dataIn); 165 } 166 info.setPeerBrokerInfos(value); 167 } 168 else { 169 info.setPeerBrokerInfos(null); 170 } 171 info.setBrokerName(looseUnmarshalString(dataIn)); 172 info.setSlaveBroker(dataIn.readBoolean()); 173 info.setMasterBroker(dataIn.readBoolean()); 174 info.setFaultTolerantConfiguration(dataIn.readBoolean()); 175 info.setDuplexConnection(dataIn.readBoolean()); 176 info.setNetworkConnection(dataIn.readBoolean()); 177 info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn)); 178 info.setBrokerUploadUrl(looseUnmarshalString(dataIn)); 179 info.setNetworkProperties(looseUnmarshalString(dataIn)); 180 181 } 182 183 184 187 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 188 189 BrokerInfo info = (BrokerInfo)o; 190 191 super.looseMarshal(wireFormat, o, dataOut); 192 looseMarshalCachedObject(wireFormat, (DataStructure)info.getBrokerId(), dataOut); 193 looseMarshalString(info.getBrokerURL(), dataOut); 194 looseMarshalObjectArray(wireFormat, info.getPeerBrokerInfos(), dataOut); 195 looseMarshalString(info.getBrokerName(), dataOut); 196 dataOut.writeBoolean(info.isSlaveBroker()); 197 dataOut.writeBoolean(info.isMasterBroker()); 198 dataOut.writeBoolean(info.isFaultTolerantConfiguration()); 199 dataOut.writeBoolean(info.isDuplexConnection()); 200 dataOut.writeBoolean(info.isNetworkConnection()); 201 looseMarshalLong(wireFormat, info.getConnectionId(), dataOut); 202 looseMarshalString(info.getBrokerUploadUrl(), dataOut); 203 looseMarshalString(info.getNetworkProperties(), dataOut); 204 205 } 206 } 207 | Popular Tags |