KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > openwire > v1 > ConsumerInfoMarshaller


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.apache.activemq.openwire.v1;
20
21 import java.io.DataInput JavaDoc;
22 import java.io.DataOutput JavaDoc;
23 import java.io.IOException JavaDoc;
24
25 import org.apache.activemq.openwire.*;
26 import org.apache.activemq.command.*;
27
28
29
30 /**
31  * Marshalling code for Open Wire Format for ConsumerInfoMarshaller
32  *
33  *
34  * NOTE!: This file is auto generated - do not modify!
35  * if you need to make a change, please see the modify the groovy scripts in the
36  * under src/gram/script and then use maven openwire:generate to regenerate
37  * this file.
38  *
39  * @version $Revision$
40  */

41 public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
42
43     /**
44      * Return the type of Data Structure we marshal
45      * @return short representation of the type data structure
46      */

47     public byte getDataStructureType() {
48         return ConsumerInfo.DATA_STRUCTURE_TYPE;
49     }
50     
51     /**
52      * @return a new object instance
53      */

54     public DataStructure createObject() {
55         return new ConsumerInfo();
56     }
57
58     /**
59      * Un-marshal an object instance from the data input stream
60      *
61      * @param o the object to un-marshal
62      * @param dataIn the data input stream to build the object from
63      * @throws IOException
64      */

65     public void tightUnmarshal(OpenWireFormat wireFormat, Object JavaDoc o, DataInput JavaDoc dataIn, BooleanStream bs) throws IOException JavaDoc {
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     /**
102      * Write the booleans that this object uses to a BooleanStream
103      */

104     public int tightMarshal1(OpenWireFormat wireFormat, Object JavaDoc o, BooleanStream bs) throws IOException JavaDoc {
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     /**
128      * Write a object instance to data output stream
129      *
130      * @param o the instance to be marshaled
131      * @param dataOut the output stream
132      * @throws IOException thrown if an error occurs
133      */

134     public void tightMarshal2(OpenWireFormat wireFormat, Object JavaDoc o, DataOutput JavaDoc dataOut, BooleanStream bs) throws IOException JavaDoc {
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     /**
159      * Un-marshal an object instance from the data input stream
160      *
161      * @param o the object to un-marshal
162      * @param dataIn the data input stream to build the object from
163      * @throws IOException
164      */

165     public void looseUnmarshal(OpenWireFormat wireFormat, Object JavaDoc o, DataInput JavaDoc dataIn) throws IOException JavaDoc {
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     /**
202      * Write the booleans that this object uses to a BooleanStream
203      */

204     public void looseMarshal(OpenWireFormat wireFormat, Object JavaDoc o, DataOutput JavaDoc dataOut) throws IOException JavaDoc {
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