001/** 002 * 003 * Licensed to the Apache Software Foundation (ASF) under one or more 004 * contributor license agreements. See the NOTICE file distributed with 005 * this work for additional information regarding copyright ownership. 006 * The ASF licenses this file to You under the Apache License, Version 2.0 007 * (the "License"); you may not use this file except in compliance with 008 * the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.activemq.openwire.v10; 020 021import java.io.DataInput; 022import java.io.DataOutput; 023import java.io.IOException; 024 025import org.apache.activemq.openwire.*; 026import org.apache.activemq.command.*; 027 028 029 030/** 031 * Marshalling code for Open Wire Format for ConsumerInfoMarshaller 032 * 033 * 034 * NOTE!: This file is auto generated - do not modify! 035 * if you need to make a change, please see the modify the groovy scripts in the 036 * under src/gram/script and then use maven openwire:generate to regenerate 037 * this file. 038 * 039 * 040 */ 041public class ConsumerInfoMarshaller extends BaseCommandMarshaller { 042 043 /** 044 * Return the type of Data Structure we marshal 045 * @return short representation of the type data structure 046 */ 047 public byte getDataStructureType() { 048 return ConsumerInfo.DATA_STRUCTURE_TYPE; 049 } 050 051 /** 052 * @return a new object instance 053 */ 054 public DataStructure createObject() { 055 return new ConsumerInfo(); 056 } 057 058 /** 059 * Un-marshal an object instance from the data input stream 060 * 061 * @param o the object to un-marshal 062 * @param dataIn the data input stream to build the object from 063 * @throws IOException 064 */ 065 public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { 066 super.tightUnmarshal(wireFormat, o, dataIn, bs); 067 068 ConsumerInfo info = (ConsumerInfo)o; 069 info.setConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 070 info.setBrowser(bs.readBoolean()); 071 info.setDestination((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); 072 info.setPrefetchSize(dataIn.readInt()); 073 info.setMaximumPendingMessageLimit(dataIn.readInt()); 074 info.setDispatchAsync(bs.readBoolean()); 075 info.setSelector(tightUnmarshalString(dataIn, bs)); 076 info.setClientId(tightUnmarshalString(dataIn, bs)); 077 info.setSubscriptionName(tightUnmarshalString(dataIn, bs)); 078 info.setNoLocal(bs.readBoolean()); 079 info.setExclusive(bs.readBoolean()); 080 info.setRetroactive(bs.readBoolean()); 081 info.setPriority(dataIn.readByte()); 082 083 if (bs.readBoolean()) { 084 short size = dataIn.readShort(); 085 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 086 for( int i=0; i < size; i++ ) { 087 value[i] = (org.apache.activemq.command.BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 088 } 089 info.setBrokerPath(value); 090 } 091 else { 092 info.setBrokerPath(null); 093 } 094 info.setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); 095 info.setNetworkSubscription(bs.readBoolean()); 096 info.setOptimizedAcknowledge(bs.readBoolean()); 097 info.setNoRangeAcks(bs.readBoolean()); 098 099 if (bs.readBoolean()) { 100 short size = dataIn.readShort(); 101 org.apache.activemq.command.ConsumerId value[] = new org.apache.activemq.command.ConsumerId[size]; 102 for( int i=0; i < size; i++ ) { 103 value[i] = (org.apache.activemq.command.ConsumerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs); 104 } 105 info.setNetworkConsumerPath(value); 106 } 107 else { 108 info.setNetworkConsumerPath(null); 109 } 110 111 } 112 113 114 /** 115 * Write the booleans that this object uses to a BooleanStream 116 */ 117 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { 118 119 ConsumerInfo info = (ConsumerInfo)o; 120 121 int rc = super.tightMarshal1(wireFormat, o, bs); 122 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs); 123 bs.writeBoolean(info.isBrowser()); 124 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); 125 bs.writeBoolean(info.isDispatchAsync()); 126 rc += tightMarshalString1(info.getSelector(), bs); 127 rc += tightMarshalString1(info.getClientId(), bs); 128 rc += tightMarshalString1(info.getSubscriptionName(), bs); 129 bs.writeBoolean(info.isNoLocal()); 130 bs.writeBoolean(info.isExclusive()); 131 bs.writeBoolean(info.isRetroactive()); 132 rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); 133 rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getAdditionalPredicate(), bs); 134 bs.writeBoolean(info.isNetworkSubscription()); 135 bs.writeBoolean(info.isOptimizedAcknowledge()); 136 bs.writeBoolean(info.isNoRangeAcks()); 137 rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs); 138 139 return rc + 9; 140 } 141 142 /** 143 * Write a object instance to data output stream 144 * 145 * @param o the instance to be marshaled 146 * @param dataOut the output stream 147 * @throws IOException thrown if an error occurs 148 */ 149 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { 150 super.tightMarshal2(wireFormat, o, dataOut, bs); 151 152 ConsumerInfo info = (ConsumerInfo)o; 153 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs); 154 bs.readBoolean(); 155 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); 156 dataOut.writeInt(info.getPrefetchSize()); 157 dataOut.writeInt(info.getMaximumPendingMessageLimit()); 158 bs.readBoolean(); 159 tightMarshalString2(info.getSelector(), dataOut, bs); 160 tightMarshalString2(info.getClientId(), dataOut, bs); 161 tightMarshalString2(info.getSubscriptionName(), dataOut, bs); 162 bs.readBoolean(); 163 bs.readBoolean(); 164 bs.readBoolean(); 165 dataOut.writeByte(info.getPriority()); 166 tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); 167 tightMarshalNestedObject2(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut, bs); 168 bs.readBoolean(); 169 bs.readBoolean(); 170 bs.readBoolean(); 171 tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), dataOut, bs); 172 173 } 174 175 /** 176 * Un-marshal an object instance from the data input stream 177 * 178 * @param o the object to un-marshal 179 * @param dataIn the data input stream to build the object from 180 * @throws IOException 181 */ 182 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { 183 super.looseUnmarshal(wireFormat, o, dataIn); 184 185 ConsumerInfo info = (ConsumerInfo)o; 186 info.setConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); 187 info.setBrowser(dataIn.readBoolean()); 188 info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); 189 info.setPrefetchSize(dataIn.readInt()); 190 info.setMaximumPendingMessageLimit(dataIn.readInt()); 191 info.setDispatchAsync(dataIn.readBoolean()); 192 info.setSelector(looseUnmarshalString(dataIn)); 193 info.setClientId(looseUnmarshalString(dataIn)); 194 info.setSubscriptionName(looseUnmarshalString(dataIn)); 195 info.setNoLocal(dataIn.readBoolean()); 196 info.setExclusive(dataIn.readBoolean()); 197 info.setRetroactive(dataIn.readBoolean()); 198 info.setPriority(dataIn.readByte()); 199 200 if (dataIn.readBoolean()) { 201 short size = dataIn.readShort(); 202 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size]; 203 for( int i=0; i < size; i++ ) { 204 value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn); 205 } 206 info.setBrokerPath(value); 207 } 208 else { 209 info.setBrokerPath(null); 210 } 211 info.setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression) looseUnmarsalNestedObject(wireFormat, dataIn)); 212 info.setNetworkSubscription(dataIn.readBoolean()); 213 info.setOptimizedAcknowledge(dataIn.readBoolean()); 214 info.setNoRangeAcks(dataIn.readBoolean()); 215 216 if (dataIn.readBoolean()) { 217 short size = dataIn.readShort(); 218 org.apache.activemq.command.ConsumerId value[] = new org.apache.activemq.command.ConsumerId[size]; 219 for( int i=0; i < size; i++ ) { 220 value[i] = (org.apache.activemq.command.ConsumerId) looseUnmarsalNestedObject(wireFormat,dataIn); 221 } 222 info.setNetworkConsumerPath(value); 223 } 224 else { 225 info.setNetworkConsumerPath(null); 226 } 227 228 } 229 230 231 /** 232 * Write the booleans that this object uses to a BooleanStream 233 */ 234 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { 235 236 ConsumerInfo info = (ConsumerInfo)o; 237 238 super.looseMarshal(wireFormat, o, dataOut); 239 looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); 240 dataOut.writeBoolean(info.isBrowser()); 241 looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); 242 dataOut.writeInt(info.getPrefetchSize()); 243 dataOut.writeInt(info.getMaximumPendingMessageLimit()); 244 dataOut.writeBoolean(info.isDispatchAsync()); 245 looseMarshalString(info.getSelector(), dataOut); 246 looseMarshalString(info.getClientId(), dataOut); 247 looseMarshalString(info.getSubscriptionName(), dataOut); 248 dataOut.writeBoolean(info.isNoLocal()); 249 dataOut.writeBoolean(info.isExclusive()); 250 dataOut.writeBoolean(info.isRetroactive()); 251 dataOut.writeByte(info.getPriority()); 252 looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); 253 looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); 254 dataOut.writeBoolean(info.isNetworkSubscription()); 255 dataOut.writeBoolean(info.isOptimizedAcknowledge()); 256 dataOut.writeBoolean(info.isNoRangeAcks()); 257 looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut); 258 259 } 260}