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
019 package org.apache.activemq.openwire.v8;
020
021 import java.io.DataInput;
022 import java.io.DataOutput;
023 import java.io.IOException;
024
025 import org.apache.activemq.openwire.*;
026 import org.apache.activemq.command.*;
027
028
029
030 /**
031 * Marshalling code for Open Wire Format for ConnectionInfoMarshaller
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 */
041 public class ConnectionInfoMarshaller 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 ConnectionInfo.DATA_STRUCTURE_TYPE;
049 }
050
051 /**
052 * @return a new object instance
053 */
054 public DataStructure createObject() {
055 return new ConnectionInfo();
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 ConnectionInfo info = (ConnectionInfo)o;
069 info.setConnectionId((org.apache.activemq.command.ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
070 info.setClientId(tightUnmarshalString(dataIn, bs));
071 info.setPassword(tightUnmarshalString(dataIn, bs));
072 info.setUserName(tightUnmarshalString(dataIn, bs));
073
074 if (bs.readBoolean()) {
075 short size = dataIn.readShort();
076 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
077 for( int i=0; i < size; i++ ) {
078 value[i] = (org.apache.activemq.command.BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs);
079 }
080 info.setBrokerPath(value);
081 }
082 else {
083 info.setBrokerPath(null);
084 }
085 info.setBrokerMasterConnector(bs.readBoolean());
086 info.setManageable(bs.readBoolean());
087 info.setClientMaster(bs.readBoolean());
088 info.setFaultTolerant(bs.readBoolean());
089 info.setFailoverReconnect(bs.readBoolean());
090 info.setClientIp(tightUnmarshalString(dataIn, bs));
091
092 }
093
094
095 /**
096 * Write the booleans that this object uses to a BooleanStream
097 */
098 public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
099
100 ConnectionInfo info = (ConnectionInfo)o;
101
102 int rc = super.tightMarshal1(wireFormat, o, bs);
103 rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs);
104 rc += tightMarshalString1(info.getClientId(), bs);
105 rc += tightMarshalString1(info.getPassword(), bs);
106 rc += tightMarshalString1(info.getUserName(), bs);
107 rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
108 bs.writeBoolean(info.isBrokerMasterConnector());
109 bs.writeBoolean(info.isManageable());
110 bs.writeBoolean(info.isClientMaster());
111 bs.writeBoolean(info.isFaultTolerant());
112 bs.writeBoolean(info.isFailoverReconnect());
113 rc += tightMarshalString1(info.getClientIp(), bs);
114
115 return rc + 0;
116 }
117
118 /**
119 * Write a object instance to data output stream
120 *
121 * @param o the instance to be marshaled
122 * @param dataOut the output stream
123 * @throws IOException thrown if an error occurs
124 */
125 public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
126 super.tightMarshal2(wireFormat, o, dataOut, bs);
127
128 ConnectionInfo info = (ConnectionInfo)o;
129 tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs);
130 tightMarshalString2(info.getClientId(), dataOut, bs);
131 tightMarshalString2(info.getPassword(), dataOut, bs);
132 tightMarshalString2(info.getUserName(), dataOut, bs);
133 tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
134 bs.readBoolean();
135 bs.readBoolean();
136 bs.readBoolean();
137 bs.readBoolean();
138 bs.readBoolean();
139 tightMarshalString2(info.getClientIp(), dataOut, bs);
140
141 }
142
143 /**
144 * Un-marshal an object instance from the data input stream
145 *
146 * @param o the object to un-marshal
147 * @param dataIn the data input stream to build the object from
148 * @throws IOException
149 */
150 public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
151 super.looseUnmarshal(wireFormat, o, dataIn);
152
153 ConnectionInfo info = (ConnectionInfo)o;
154 info.setConnectionId((org.apache.activemq.command.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
155 info.setClientId(looseUnmarshalString(dataIn));
156 info.setPassword(looseUnmarshalString(dataIn));
157 info.setUserName(looseUnmarshalString(dataIn));
158
159 if (dataIn.readBoolean()) {
160 short size = dataIn.readShort();
161 org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
162 for( int i=0; i < size; i++ ) {
163 value[i] = (org.apache.activemq.command.BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn);
164 }
165 info.setBrokerPath(value);
166 }
167 else {
168 info.setBrokerPath(null);
169 }
170 info.setBrokerMasterConnector(dataIn.readBoolean());
171 info.setManageable(dataIn.readBoolean());
172 info.setClientMaster(dataIn.readBoolean());
173 info.setFaultTolerant(dataIn.readBoolean());
174 info.setFailoverReconnect(dataIn.readBoolean());
175 info.setClientIp(looseUnmarshalString(dataIn));
176
177 }
178
179
180 /**
181 * Write the booleans that this object uses to a BooleanStream
182 */
183 public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
184
185 ConnectionInfo info = (ConnectionInfo)o;
186
187 super.looseMarshal(wireFormat, o, dataOut);
188 looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut);
189 looseMarshalString(info.getClientId(), dataOut);
190 looseMarshalString(info.getPassword(), dataOut);
191 looseMarshalString(info.getUserName(), dataOut);
192 looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
193 dataOut.writeBoolean(info.isBrokerMasterConnector());
194 dataOut.writeBoolean(info.isManageable());
195 dataOut.writeBoolean(info.isClientMaster());
196 dataOut.writeBoolean(info.isFaultTolerant());
197 dataOut.writeBoolean(info.isFailoverReconnect());
198 looseMarshalString(info.getClientIp(), dataOut);
199
200 }
201 }