001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.activemq.openwire.v3;
019
020 import java.io.DataInput;
021 import java.io.DataOutput;
022 import java.io.IOException;
023
024 import org.apache.activemq.command.DataStructure;
025 import org.apache.activemq.command.MessagePull;
026 import org.apache.activemq.openwire.BooleanStream;
027 import org.apache.activemq.openwire.OpenWireFormat;
028
029 /**
030 * Marshalling code for Open Wire Format for MessagePullMarshaller
031 *
032 *
033 * NOTE!: This file is auto generated - do not modify! if you need to make a
034 * change, please see the modify the groovy scripts in the under src/gram/script
035 * and then use maven openwire:generate to regenerate this file.
036 *
037 *
038 */
039 public class MessagePullMarshaller extends BaseCommandMarshaller {
040
041 /**
042 * Return the type of Data Structure we marshal
043 *
044 * @return short representation of the type data structure
045 */
046 public byte getDataStructureType() {
047 return MessagePull.DATA_STRUCTURE_TYPE;
048 }
049
050 /**
051 * @return a new object instance
052 */
053 public DataStructure createObject() {
054 return new MessagePull();
055 }
056
057 /**
058 * Un-marshal an object instance from the data input stream
059 *
060 * @param o the object to un-marshal
061 * @param dataIn the data input stream to build the object from
062 * @throws IOException
063 */
064 public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
065 throws IOException {
066 super.tightUnmarshal(wireFormat, o, dataIn, bs);
067
068 MessagePull info = (MessagePull)o;
069 info.setConsumerId((org.apache.activemq.command.ConsumerId)tightUnmarsalCachedObject(wireFormat,
070 dataIn, bs));
071 info
072 .setDestination((org.apache.activemq.command.ActiveMQDestination)tightUnmarsalCachedObject(
073 wireFormat,
074 dataIn,
075 bs));
076 info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
077 info.setCorrelationId(tightUnmarshalString(dataIn, bs));
078 info.setMessageId((org.apache.activemq.command.MessageId)tightUnmarsalNestedObject(wireFormat,
079 dataIn, bs));
080
081 }
082
083 /**
084 * Write the booleans that this object uses to a BooleanStream
085 */
086 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
087
088 MessagePull info = (MessagePull)o;
089
090 int rc = super.tightMarshal1(wireFormat, o, bs);
091 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
092 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs);
093 rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
094 rc += tightMarshalString1(info.getCorrelationId(), bs);
095 rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getMessageId(), bs);
096
097 return rc + 0;
098 }
099
100 /**
101 * Write a object instance to data output stream
102 *
103 * @param o the instance to be marshaled
104 * @param dataOut the output stream
105 * @throws IOException thrown if an error occurs
106 */
107 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
108 throws IOException {
109 super.tightMarshal2(wireFormat, o, dataOut, bs);
110
111 MessagePull info = (MessagePull)o;
112 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs);
113 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
114 tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
115 tightMarshalString2(info.getCorrelationId(), dataOut, bs);
116 tightMarshalNestedObject2(wireFormat, (DataStructure)info.getMessageId(), dataOut, bs);
117
118 }
119
120 /**
121 * Un-marshal an object instance from the data input stream
122 *
123 * @param o the object to un-marshal
124 * @param dataIn the data input stream to build the object from
125 * @throws IOException
126 */
127 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
128 super.looseUnmarshal(wireFormat, o, dataIn);
129
130 MessagePull info = (MessagePull)o;
131 info.setConsumerId((org.apache.activemq.command.ConsumerId)looseUnmarsalCachedObject(wireFormat,
132 dataIn));
133 info
134 .setDestination((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalCachedObject(
135 wireFormat,
136 dataIn));
137 info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
138 info.setCorrelationId(looseUnmarshalString(dataIn));
139 info
140 .setMessageId((org.apache.activemq.command.MessageId)looseUnmarsalNestedObject(wireFormat, dataIn));
141
142 }
143
144 /**
145 * Write the booleans that this object uses to a BooleanStream
146 */
147 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
148
149 MessagePull info = (MessagePull)o;
150
151 super.looseMarshal(wireFormat, o, dataOut);
152 looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut);
153 looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
154 looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
155 looseMarshalString(info.getCorrelationId(), dataOut);
156 looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut);
157
158 }
159 }