Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 850F440F for ; Wed, 27 Apr 2011 17:33:42 +0000 (UTC) Received: (qmail 45485 invoked by uid 500); 27 Apr 2011 17:33:42 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 45461 invoked by uid 500); 27 Apr 2011 17:33:42 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 45454 invoked by uid 99); 27 Apr 2011 17:33:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2011 17:33:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2011 17:33:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3B7882388B3A; Wed, 27 Apr 2011 17:33:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1097189 [4/42] - in /activemq/activemq-apollo/trunk: ./ apollo-openwire/ apollo-openwire/src/ apollo-openwire/src/main/ apollo-openwire/src/main/resources/ apollo-openwire/src/main/resources/META-INF/ apollo-openwire/src/main/resources/MET... Date: Wed, 27 Apr 2011 17:33:09 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110427173318.3B7882388B3A@eris.apache.org> Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,645 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.lang.reflect.Constructor; + +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.DataStreamMarshaller; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; +import org.fusesource.hawtbuf.Buffer; + +public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller { + + public static final Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR; + + static { + Constructor constructor = null; + try { + constructor = StackTraceElement.class.getConstructor(new Class[] {String.class, String.class, + String.class, int.class}); + } catch (Throwable e) { + } + STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor; + } + + public abstract byte getDataStructureType(); + + public abstract DataStructure createObject(); + + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + return 0; + } + + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) + throws IOException { + } + + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) + throws IOException { + } + + public int tightMarshalLong1(OpenWireFormat wireFormat, long o, BooleanStream bs) throws IOException { + if (o == 0) { + bs.writeBoolean(false); + bs.writeBoolean(false); + return 0; + } else if ((o & 0xFFFFFFFFFFFF0000L) == 0) { + bs.writeBoolean(false); + bs.writeBoolean(true); + return 2; + } else if ((o & 0xFFFFFFFF00000000L) == 0) { + bs.writeBoolean(true); + bs.writeBoolean(false); + return 4; + } else { + bs.writeBoolean(true); + bs.writeBoolean(true); + return 8; + } + } + + public void tightMarshalLong2(OpenWireFormat wireFormat, long o, DataOutput dataOut, BooleanStream bs) + throws IOException { + if (bs.readBoolean()) { + if (bs.readBoolean()) { + dataOut.writeLong(o); + } else { + dataOut.writeInt((int)o); + } + } else { + if (bs.readBoolean()) { + dataOut.writeShort((int)o); + } + } + } + + public long tightUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) + throws IOException { + if (bs.readBoolean()) { + if (bs.readBoolean()) { + return dataIn.readLong(); + } else { + return toLong(dataIn.readInt()); + } + } else { + if (bs.readBoolean()) { + return toLong(dataIn.readShort()); + } else { + return 0; + } + } + } + + protected long toLong(short value) { + // lets handle negative values + long answer = value; + return answer & 0xffffL; + } + + protected long toLong(int value) { + // lets handle negative values + long answer = value; + return answer & 0xffffffffL; + } + + protected DataStructure tightUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn, + BooleanStream bs) throws IOException { + return wireFormat.tightUnmarshalNestedObject(dataIn, bs); + } + + protected int tightMarshalNestedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) + throws IOException { + return wireFormat.tightMarshalNestedObject1(o, bs); + } + + protected void tightMarshalNestedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, + BooleanStream bs) throws IOException { + wireFormat.tightMarshalNestedObject2(o, dataOut, bs); + } + + protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn, + BooleanStream bs) throws IOException { + if (wireFormat.isCacheEnabled()) { + if (bs.readBoolean()) { + short index = dataIn.readShort(); + DataStructure object = wireFormat.tightUnmarshalNestedObject(dataIn, bs); + wireFormat.setInUnmarshallCache(index, object); + return object; + } else { + short index = dataIn.readShort(); + return wireFormat.getFromUnmarshallCache(index); + } + } else { + return wireFormat.tightUnmarshalNestedObject(dataIn, bs); + } + } + + protected int tightMarshalCachedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) + throws IOException { + if (wireFormat.isCacheEnabled()) { + Short index = wireFormat.getMarshallCacheIndex(o); + bs.writeBoolean(index == null); + if (index == null) { + int rc = wireFormat.tightMarshalNestedObject1(o, bs); + wireFormat.addToMarshallCache(o); + return 2 + rc; + } else { + return 2; + } + } else { + return wireFormat.tightMarshalNestedObject1(o, bs); + } + } + + protected void tightMarshalCachedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, + BooleanStream bs) throws IOException { + if (wireFormat.isCacheEnabled()) { + Short index = wireFormat.getMarshallCacheIndex(o); + if (bs.readBoolean()) { + dataOut.writeShort(index.shortValue()); + wireFormat.tightMarshalNestedObject2(o, dataOut, bs); + } else { + dataOut.writeShort(index.shortValue()); + } + } else { + wireFormat.tightMarshalNestedObject2(o, dataOut, bs); + } + } + + protected Throwable tightUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) + throws IOException { + if (bs.readBoolean()) { + String clazz = tightUnmarshalString(dataIn, bs); + String message = tightUnmarshalString(dataIn, bs); + Throwable o = createThrowable(clazz, message); + if (wireFormat.isStackTraceEnabled()) { + if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) { + StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()]; + for (int i = 0; i < ss.length; i++) { + try { + ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR + .newInstance(new Object[] {tightUnmarshalString(dataIn, bs), + tightUnmarshalString(dataIn, bs), + tightUnmarshalString(dataIn, bs), + new Integer(dataIn.readInt())}); + } catch (IOException e) { + throw e; + } catch (Throwable e) { + } + } + o.setStackTrace(ss); + } else { + short size = dataIn.readShort(); + for (int i = 0; i < size; i++) { + tightUnmarshalString(dataIn, bs); + tightUnmarshalString(dataIn, bs); + tightUnmarshalString(dataIn, bs); + dataIn.readInt(); + } + } + o.initCause(tightUnmarsalThrowable(wireFormat, dataIn, bs)); + + } + return o; + } else { + return null; + } + } + + private Throwable createThrowable(String className, String message) { + try { + Class clazz = Class.forName(className, false, BaseDataStreamMarshaller.class.getClassLoader()); + Constructor constructor = clazz.getConstructor(new Class[] {String.class}); + return (Throwable)constructor.newInstance(new Object[] {message}); + } catch (Throwable e) { + return new Throwable(className + ": " + message); + } + } + + protected int tightMarshalThrowable1(OpenWireFormat wireFormat, Throwable o, BooleanStream bs) + throws IOException { + if (o == null) { + bs.writeBoolean(false); + return 0; + } else { + int rc = 0; + bs.writeBoolean(true); + rc += tightMarshalString1(o.getClass().getName(), bs); + rc += tightMarshalString1(o.getMessage(), bs); + if (wireFormat.isStackTraceEnabled()) { + rc += 2; + StackTraceElement[] stackTrace = o.getStackTrace(); + for (int i = 0; i < stackTrace.length; i++) { + StackTraceElement element = stackTrace[i]; + rc += tightMarshalString1(element.getClassName(), bs); + rc += tightMarshalString1(element.getMethodName(), bs); + rc += tightMarshalString1(element.getFileName(), bs); + rc += 4; + } + rc += tightMarshalThrowable1(wireFormat, o.getCause(), bs); + } + return rc; + } + } + + protected void tightMarshalThrowable2(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut, + BooleanStream bs) throws IOException { + if (bs.readBoolean()) { + tightMarshalString2(o.getClass().getName(), dataOut, bs); + tightMarshalString2(o.getMessage(), dataOut, bs); + if (wireFormat.isStackTraceEnabled()) { + StackTraceElement[] stackTrace = o.getStackTrace(); + dataOut.writeShort(stackTrace.length); + for (int i = 0; i < stackTrace.length; i++) { + StackTraceElement element = stackTrace[i]; + tightMarshalString2(element.getClassName(), dataOut, bs); + tightMarshalString2(element.getMethodName(), dataOut, bs); + tightMarshalString2(element.getFileName(), dataOut, bs); + dataOut.writeInt(element.getLineNumber()); + } + tightMarshalThrowable2(wireFormat, o.getCause(), dataOut, bs); + } + } + } + + @SuppressWarnings("deprecation") + protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException { + if (bs.readBoolean()) { + if (bs.readBoolean()) { + int size = dataIn.readShort(); + byte data[] = new byte[size]; + dataIn.readFully(data); + // Yes deprecated, but we know what we are doing. + // This allows us to create a String from a ASCII byte array. (no UTF-8 decoding) + return new String(data, 0); + } else { + return dataIn.readUTF(); + } + } else { + return null; + } + } + + protected int tightMarshalString1(String value, BooleanStream bs) throws IOException { + bs.writeBoolean(value != null); + if (value != null) { + + int strlen = value.length(); + int utflen = 0; + char[] charr = new char[strlen]; + int c = 0; + boolean isOnlyAscii = true; + + value.getChars(0, strlen, charr, 0); + + for (int i = 0; i < strlen; i++) { + c = charr[i]; + if ((c >= 0x0001) && (c <= 0x007F)) { + utflen++; + } else if (c > 0x07FF) { + utflen += 3; + isOnlyAscii = false; + } else { + isOnlyAscii = false; + utflen += 2; + } + } + + if (utflen >= Short.MAX_VALUE) { + throw new IOException("Encountered a String value that is too long to encode."); + } + bs.writeBoolean(isOnlyAscii); + return utflen + 2; + + } else { + return 0; + } + } + + protected void tightMarshalString2(String value, DataOutput dataOut, BooleanStream bs) throws IOException { + if (bs.readBoolean()) { + // If we verified it only holds ascii values + if (bs.readBoolean()) { + dataOut.writeShort(value.length()); + dataOut.writeBytes(value); + } else { + dataOut.writeUTF(value); + } + } + } + + protected int tightMarshalObjectArray1(OpenWireFormat wireFormat, DataStructure[] objects, + BooleanStream bs) throws IOException { + if (objects != null) { + int rc = 0; + bs.writeBoolean(true); + rc += 2; + for (int i = 0; i < objects.length; i++) { + rc += tightMarshalNestedObject1(wireFormat, objects[i], bs); + } + return rc; + } else { + bs.writeBoolean(false); + return 0; + } + } + + protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects, + DataOutput dataOut, BooleanStream bs) throws IOException { + if (bs.readBoolean()) { + dataOut.writeShort(objects.length); + for (int i = 0; i < objects.length; i++) { + tightMarshalNestedObject2(wireFormat, objects[i], dataOut, bs); + } + } + } + + protected int tightMarshalConstByteArray1(byte[] data, BooleanStream bs, int i) throws IOException { + return i; + } + + protected void tightMarshalConstByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs, int i) + throws IOException { + dataOut.write(data, 0, i); + } + + protected byte[] tightUnmarshalConstByteArray(DataInput dataIn, BooleanStream bs, int i) + throws IOException { + byte data[] = new byte[i]; + dataIn.readFully(data); + return data; + } + + protected int tightMarshalByteArray1(byte[] data, BooleanStream bs) throws IOException { + bs.writeBoolean(data != null); + if (data != null) { + return data.length + 4; + } else { + return 0; + } + } + + protected void tightMarshalByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs) + throws IOException { + if (bs.readBoolean()) { + dataOut.writeInt(data.length); + dataOut.write(data); + } + } + + protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException { + byte rc[] = null; + if (bs.readBoolean()) { + int size = dataIn.readInt(); + rc = new byte[size]; + dataIn.readFully(rc); + } + return rc; + } + + protected int tightMarshalByteSequence1(Buffer data, BooleanStream bs) throws IOException { + bs.writeBoolean(data != null); + if (data != null) { + return data.getLength() + 4; + } else { + return 0; + } + } + + protected void tightMarshalByteSequence2(Buffer data, DataOutput dataOut, BooleanStream bs) + throws IOException { + if (bs.readBoolean()) { + dataOut.writeInt(data.getLength()); + dataOut.write(data.getData(), data.getOffset(), data.getLength()); + } + } + + protected Buffer tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException { + Buffer rc = null; + if (bs.readBoolean()) { + int size = dataIn.readInt(); + byte[] t = new byte[size]; + dataIn.readFully(t); + return new Buffer(t, 0, size); + } + return rc; + } + + // + // The loose marshaling logic + // + + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + } + + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + } + + public void looseMarshalLong(OpenWireFormat wireFormat, long o, DataOutput dataOut) throws IOException { + dataOut.writeLong(o); + } + + public long looseUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn) throws IOException { + return dataIn.readLong(); + } + + protected DataStructure looseUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn) + throws IOException { + return wireFormat.looseUnmarshalNestedObject(dataIn); + } + + protected void looseMarshalNestedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) + throws IOException { + wireFormat.looseMarshalNestedObject(o, dataOut); + } + + protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn) + throws IOException { + if (wireFormat.isCacheEnabled()) { + if (dataIn.readBoolean()) { + short index = dataIn.readShort(); + DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn); + wireFormat.setInUnmarshallCache(index, object); + return object; + } else { + short index = dataIn.readShort(); + return wireFormat.getFromUnmarshallCache(index); + } + } else { + return wireFormat.looseUnmarshalNestedObject(dataIn); + } + } + + protected void looseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) + throws IOException { + if (wireFormat.isCacheEnabled()) { + Short index = wireFormat.getMarshallCacheIndex(o); + dataOut.writeBoolean(index == null); + if (index == null) { + index = wireFormat.addToMarshallCache(o); + dataOut.writeShort(index.shortValue()); + wireFormat.looseMarshalNestedObject(o, dataOut); + } else { + dataOut.writeShort(index.shortValue()); + } + } else { + wireFormat.looseMarshalNestedObject(o, dataOut); + } + } + + protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn) + throws IOException { + if (dataIn.readBoolean()) { + String clazz = looseUnmarshalString(dataIn); + String message = looseUnmarshalString(dataIn); + Throwable o = createThrowable(clazz, message); + if (wireFormat.isStackTraceEnabled()) { + if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) { + StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()]; + for (int i = 0; i < ss.length; i++) { + try { + ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR + .newInstance(new Object[] {looseUnmarshalString(dataIn), + looseUnmarshalString(dataIn), + looseUnmarshalString(dataIn), + new Integer(dataIn.readInt())}); + } catch (IOException e) { + throw e; + } catch (Throwable e) { + } + } + o.setStackTrace(ss); + } else { + short size = dataIn.readShort(); + for (int i = 0; i < size; i++) { + looseUnmarshalString(dataIn); + looseUnmarshalString(dataIn); + looseUnmarshalString(dataIn); + dataIn.readInt(); + } + } + o.initCause(looseUnmarsalThrowable(wireFormat, dataIn)); + + } + return o; + } else { + return null; + } + } + + protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut) + throws IOException { + dataOut.writeBoolean(o != null); + if (o != null) { + looseMarshalString(o.getClass().getName(), dataOut); + looseMarshalString(o.getMessage(), dataOut); + if (wireFormat.isStackTraceEnabled()) { + StackTraceElement[] stackTrace = o.getStackTrace(); + dataOut.writeShort(stackTrace.length); + for (int i = 0; i < stackTrace.length; i++) { + StackTraceElement element = stackTrace[i]; + looseMarshalString(element.getClassName(), dataOut); + looseMarshalString(element.getMethodName(), dataOut); + looseMarshalString(element.getFileName(), dataOut); + dataOut.writeInt(element.getLineNumber()); + } + looseMarshalThrowable(wireFormat, o.getCause(), dataOut); + } + } + } + + protected String looseUnmarshalString(DataInput dataIn) throws IOException { + if (dataIn.readBoolean()) { + return dataIn.readUTF(); + } else { + return null; + } + } + + protected void looseMarshalString(String value, DataOutput dataOut) throws IOException { + dataOut.writeBoolean(value != null); + if (value != null) { + dataOut.writeUTF(value); + } + } + + protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects, + DataOutput dataOut) throws IOException { + dataOut.writeBoolean(objects != null); + if (objects != null) { + dataOut.writeShort(objects.length); + for (int i = 0; i < objects.length; i++) { + looseMarshalNestedObject(wireFormat, objects[i], dataOut); + } + } + } + + protected void looseMarshalConstByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut, + int i) throws IOException { + dataOut.write(data, 0, i); + } + + protected byte[] looseUnmarshalConstByteArray(DataInput dataIn, int i) throws IOException { + byte data[] = new byte[i]; + dataIn.readFully(data); + return data; + } + + protected void looseMarshalByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut) + throws IOException { + dataOut.writeBoolean(data != null); + if (data != null) { + dataOut.writeInt(data.length); + dataOut.write(data); + } + } + + protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException { + byte rc[] = null; + if (dataIn.readBoolean()) { + int size = dataIn.readInt(); + rc = new byte[size]; + dataIn.readFully(rc); + } + return rc; + } + + protected void looseMarshalByteSequence(OpenWireFormat wireFormat, Buffer data, DataOutput dataOut) + throws IOException { + dataOut.writeBoolean(data != null); + if (data != null) { + dataOut.writeInt(data.getLength()); + dataOut.write(data.getData(), data.getOffset(), data.getLength()); + } + } + + protected Buffer looseUnmarshalByteSequence(DataInput dataIn) throws IOException { + Buffer rc = null; + if (dataIn.readBoolean()) { + int size = dataIn.readInt(); + byte[] t = new byte[size]; + dataIn.readFully(t); + rc = new Buffer(t, 0, size); + } + return rc; + } +} Propchange: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java ------------------------------------------------------------------------------ svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,129 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.BrokerId; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + + + +/** + * Marshalling code for Open Wire Format for BrokerIdMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! + * if you need to make a change, please see the modify the groovy scripts in the + * under src/gram/script and then use maven openwire:generate to regenerate + * this file. + * + */ +public class BrokerIdMarshaller extends BaseDataStreamMarshaller { + + /** + * Return the type of Data Structure we marshal + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return BrokerId.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new BrokerId(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + BrokerId info = (BrokerId)o; + info.setValue(tightUnmarshalString(dataIn, bs)); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + BrokerId info = (BrokerId)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalString1(info.getValue(), bs); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + BrokerId info = (BrokerId)o; + tightMarshalString2(info.getValue(), dataOut, bs); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + BrokerId info = (BrokerId)o; + info.setValue(looseUnmarshalString(dataIn)); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + BrokerId info = (BrokerId)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalString(info.getValue(), dataOut); + + } +} Propchange: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java ------------------------------------------------------------------------------ svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,173 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.BrokerInfo; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + +/** + * Marshalling code for Open Wire Format for BrokerInfoMarshaller NOTE!: This + * file is auto generated - do not modify! if you need to make a change, please + * see the modify the groovy scripts in the under src/gram/script and then use + * maven openwire:generate to regenerate this file. + * + */ +public class BrokerInfoMarshaller extends BaseCommandMarshaller { + + /** + * Return the type of Data Structure we marshal + * + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return BrokerInfo.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new BrokerInfo(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + BrokerInfo info = (BrokerInfo)o; + info.setBrokerId((org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalCachedObject(wireFormat, dataIn, bs)); + info.setBrokerURL(tightUnmarshalString(dataIn, bs)); + + if (bs.readBoolean()) { + short size = dataIn.readShort(); + org.apache.activemq.apollo.openwire.command.BrokerInfo value[] = new org.apache.activemq.apollo.openwire.command.BrokerInfo[size]; + for (int i = 0; i < size; i++) { + value[i] = (org.apache.activemq.apollo.openwire.command.BrokerInfo)tightUnmarsalNestedObject(wireFormat, dataIn, bs); + } + info.setPeerBrokerInfos(value); + } else { + info.setPeerBrokerInfos(null); + } + info.setBrokerName(tightUnmarshalString(dataIn, bs)); + info.setSlaveBroker(bs.readBoolean()); + info.setMasterBroker(bs.readBoolean()); + info.setFaultTolerantConfiguration(bs.readBoolean()); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + BrokerInfo info = (BrokerInfo)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getBrokerId(), bs); + rc += tightMarshalString1(info.getBrokerURL(), bs); + rc += tightMarshalObjectArray1(wireFormat, info.getPeerBrokerInfos(), bs); + rc += tightMarshalString1(info.getBrokerName(), bs); + bs.writeBoolean(info.isSlaveBroker()); + bs.writeBoolean(info.isMasterBroker()); + bs.writeBoolean(info.isFaultTolerantConfiguration()); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + BrokerInfo info = (BrokerInfo)o; + tightMarshalCachedObject2(wireFormat, (DataStructure)info.getBrokerId(), dataOut, bs); + tightMarshalString2(info.getBrokerURL(), dataOut, bs); + tightMarshalObjectArray2(wireFormat, info.getPeerBrokerInfos(), dataOut, bs); + tightMarshalString2(info.getBrokerName(), dataOut, bs); + bs.readBoolean(); + bs.readBoolean(); + bs.readBoolean(); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + BrokerInfo info = (BrokerInfo)o; + info.setBrokerId((org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalCachedObject(wireFormat, dataIn)); + info.setBrokerURL(looseUnmarshalString(dataIn)); + + if (dataIn.readBoolean()) { + short size = dataIn.readShort(); + org.apache.activemq.apollo.openwire.command.BrokerInfo value[] = new org.apache.activemq.apollo.openwire.command.BrokerInfo[size]; + for (int i = 0; i < size; i++) { + value[i] = (org.apache.activemq.apollo.openwire.command.BrokerInfo)looseUnmarsalNestedObject(wireFormat, dataIn); + } + info.setPeerBrokerInfos(value); + } else { + info.setPeerBrokerInfos(null); + } + info.setBrokerName(looseUnmarshalString(dataIn)); + info.setSlaveBroker(dataIn.readBoolean()); + info.setMasterBroker(dataIn.readBoolean()); + info.setFaultTolerantConfiguration(dataIn.readBoolean()); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + BrokerInfo info = (BrokerInfo)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalCachedObject(wireFormat, (DataStructure)info.getBrokerId(), dataOut); + looseMarshalString(info.getBrokerURL(), dataOut); + looseMarshalObjectArray(wireFormat, info.getPeerBrokerInfos(), dataOut); + looseMarshalString(info.getBrokerName(), dataOut); + dataOut.writeBoolean(info.isSlaveBroker()); + dataOut.writeBoolean(info.isMasterBroker()); + dataOut.writeBoolean(info.isFaultTolerantConfiguration()); + + } +} Propchange: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java ------------------------------------------------------------------------------ svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,149 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.ConnectionControl; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + + + +/** + * Marshalling code for Open Wire Format for ConnectionControlMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! + * if you need to make a change, please see the modify the groovy scripts in the + * under src/gram/script and then use maven openwire:generate to regenerate + * this file. + * + */ +public class ConnectionControlMarshaller extends BaseCommandMarshaller { + + /** + * Return the type of Data Structure we marshal + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConnectionControl.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConnectionControl(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConnectionControl info = (ConnectionControl)o; + info.setClose(bs.readBoolean()); + info.setExit(bs.readBoolean()); + info.setFaultTolerant(bs.readBoolean()); + info.setResume(bs.readBoolean()); + info.setSuspend(bs.readBoolean()); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConnectionControl info = (ConnectionControl)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + bs.writeBoolean(info.isClose()); + bs.writeBoolean(info.isExit()); + bs.writeBoolean(info.isFaultTolerant()); + bs.writeBoolean(info.isResume()); + bs.writeBoolean(info.isSuspend()); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConnectionControl info = (ConnectionControl)o; + bs.readBoolean(); + bs.readBoolean(); + bs.readBoolean(); + bs.readBoolean(); + bs.readBoolean(); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConnectionControl info = (ConnectionControl)o; + info.setClose(dataIn.readBoolean()); + info.setExit(dataIn.readBoolean()); + info.setFaultTolerant(dataIn.readBoolean()); + info.setResume(dataIn.readBoolean()); + info.setSuspend(dataIn.readBoolean()); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConnectionControl info = (ConnectionControl)o; + + super.looseMarshal(wireFormat, o, dataOut); + dataOut.writeBoolean(info.isClose()); + dataOut.writeBoolean(info.isExit()); + dataOut.writeBoolean(info.isFaultTolerant()); + dataOut.writeBoolean(info.isResume()); + dataOut.writeBoolean(info.isSuspend()); + + } +} Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,134 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.ConnectionError; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + + + +/** + * Marshalling code for Open Wire Format for ConnectionErrorMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! + * if you need to make a change, please see the modify the groovy scripts in the + * under src/gram/script and then use maven openwire:generate to regenerate + * this file. + * + */ +public class ConnectionErrorMarshaller extends BaseCommandMarshaller { + + /** + * Return the type of Data Structure we marshal + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConnectionError.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConnectionError(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConnectionError info = (ConnectionError)o; + info.setException((java.lang.Throwable) tightUnmarsalThrowable(wireFormat, dataIn, bs)); + info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConnectionError info = (ConnectionError)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalThrowable1(wireFormat, info.getException(), bs); + rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConnectionError info = (ConnectionError)o; + tightMarshalThrowable2(wireFormat, info.getException(), dataOut, bs); + tightMarshalNestedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConnectionError info = (ConnectionError)o; + info.setException((java.lang.Throwable) looseUnmarsalThrowable(wireFormat, dataIn)); + info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId) looseUnmarsalNestedObject(wireFormat, dataIn)); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConnectionError info = (ConnectionError)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalThrowable(wireFormat, info.getException(), dataOut); + looseMarshalNestedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); + + } +} Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,129 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.ConnectionId; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + + + +/** + * Marshalling code for Open Wire Format for ConnectionIdMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! + * if you need to make a change, please see the modify the groovy scripts in the + * under src/gram/script and then use maven openwire:generate to regenerate + * this file. + * + */ +public class ConnectionIdMarshaller extends BaseDataStreamMarshaller { + + /** + * Return the type of Data Structure we marshal + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConnectionId.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConnectionId(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConnectionId info = (ConnectionId)o; + info.setValue(tightUnmarshalString(dataIn, bs)); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConnectionId info = (ConnectionId)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalString1(info.getValue(), bs); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConnectionId info = (ConnectionId)o; + tightMarshalString2(info.getValue(), dataOut, bs); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConnectionId info = (ConnectionId)o; + info.setValue(looseUnmarshalString(dataIn)); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConnectionId info = (ConnectionId)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalString(info.getValue(), dataOut); + + } +} Propchange: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java ------------------------------------------------------------------------------ svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,180 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.ConnectionInfo; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + +/** + * Marshalling code for Open Wire Format for ConnectionInfoMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! if you need to make a + * change, please see the modify the groovy scripts in the under src/gram/script + * and then use maven openwire:generate to regenerate this file. + * + */ +public class ConnectionInfoMarshaller extends BaseCommandMarshaller { + + /** + * Return the type of Data Structure we marshal + * + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConnectionInfo.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConnectionInfo(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) + throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConnectionInfo info = (ConnectionInfo)o; + info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId)tightUnmarsalCachedObject(wireFormat, + dataIn, bs)); + info.setClientId(tightUnmarshalString(dataIn, bs)); + info.setPassword(tightUnmarshalString(dataIn, bs)); + info.setUserName(tightUnmarshalString(dataIn, bs)); + + if (bs.readBoolean()) { + short size = dataIn.readShort(); + org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size]; + for (int i = 0; i < size; i++) { + value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalNestedObject(wireFormat, + dataIn, bs); + } + info.setBrokerPath(value); + } else { + info.setBrokerPath(null); + } + info.setBrokerMasterConnector(bs.readBoolean()); + info.setManageable(bs.readBoolean()); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConnectionInfo info = (ConnectionInfo)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs); + rc += tightMarshalString1(info.getClientId(), bs); + rc += tightMarshalString1(info.getPassword(), bs); + rc += tightMarshalString1(info.getUserName(), bs); + rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); + bs.writeBoolean(info.isBrokerMasterConnector()); + bs.writeBoolean(info.isManageable()); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) + throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConnectionInfo info = (ConnectionInfo)o; + tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs); + tightMarshalString2(info.getClientId(), dataOut, bs); + tightMarshalString2(info.getPassword(), dataOut, bs); + tightMarshalString2(info.getUserName(), dataOut, bs); + tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); + bs.readBoolean(); + bs.readBoolean(); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConnectionInfo info = (ConnectionInfo)o; + info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId)looseUnmarsalCachedObject(wireFormat, + dataIn)); + info.setClientId(looseUnmarshalString(dataIn)); + info.setPassword(looseUnmarshalString(dataIn)); + info.setUserName(looseUnmarshalString(dataIn)); + + if (dataIn.readBoolean()) { + short size = dataIn.readShort(); + org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size]; + for (int i = 0; i < size; i++) { + value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn); + } + info.setBrokerPath(value); + } else { + info.setBrokerPath(null); + } + info.setBrokerMasterConnector(dataIn.readBoolean()); + info.setManageable(dataIn.readBoolean()); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConnectionInfo info = (ConnectionInfo)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); + looseMarshalString(info.getClientId(), dataOut); + looseMarshalString(info.getPassword(), dataOut); + looseMarshalString(info.getUserName(), dataOut); + looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); + dataOut.writeBoolean(info.isBrokerMasterConnector()); + dataOut.writeBoolean(info.isManageable()); + + } +} Propchange: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java ------------------------------------------------------------------------------ svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,138 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.ConsumerControl; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + + + +/** + * Marshalling code for Open Wire Format for ConsumerControlMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! + * if you need to make a change, please see the modify the groovy scripts in the + * under src/gram/script and then use maven openwire:generate to regenerate + * this file. + * + */ +public class ConsumerControlMarshaller extends BaseCommandMarshaller { + + /** + * Return the type of Data Structure we marshal + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConsumerControl.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConsumerControl(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConsumerControl info = (ConsumerControl)o; + info.setClose(bs.readBoolean()); + info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); + info.setPrefetch(dataIn.readInt()); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConsumerControl info = (ConsumerControl)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + bs.writeBoolean(info.isClose()); + rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs); + + return rc + 4; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConsumerControl info = (ConsumerControl)o; + bs.readBoolean(); + tightMarshalNestedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs); + dataOut.writeInt(info.getPrefetch()); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConsumerControl info = (ConsumerControl)o; + info.setClose(dataIn.readBoolean()); + info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn)); + info.setPrefetch(dataIn.readInt()); + + } + + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConsumerControl info = (ConsumerControl)o; + + super.looseMarshal(wireFormat, o, dataOut); + dataOut.writeBoolean(info.isClose()); + looseMarshalNestedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); + dataOut.writeInt(info.getPrefetch()); + + } +} Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,137 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.openwire.command.ConsumerId; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + +/** + * Marshalling code for Open Wire Format for ConsumerIdMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! if you need to make a + * change, please see the modify the groovy scripts in the under src/gram/script + * and then use maven openwire:generate to regenerate this file. + * + */ +public class ConsumerIdMarshaller extends BaseDataStreamMarshaller { + + /** + * Return the type of Data Structure we marshal + * + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConsumerId.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConsumerId(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) + throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConsumerId info = (ConsumerId)o; + info.setConnectionId(tightUnmarshalString(dataIn, bs)); + info.setSessionId(tightUnmarshalLong(wireFormat, dataIn, bs)); + info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs)); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConsumerId info = (ConsumerId)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalString1(info.getConnectionId(), bs); + rc += tightMarshalLong1(wireFormat, info.getSessionId(), bs); + rc += tightMarshalLong1(wireFormat, info.getValue(), bs); + + return rc + 0; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) + throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConsumerId info = (ConsumerId)o; + tightMarshalString2(info.getConnectionId(), dataOut, bs); + tightMarshalLong2(wireFormat, info.getSessionId(), dataOut, bs); + tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConsumerId info = (ConsumerId)o; + info.setConnectionId(looseUnmarshalString(dataIn)); + info.setSessionId(looseUnmarshalLong(wireFormat, dataIn)); + info.setValue(looseUnmarshalLong(wireFormat, dataIn)); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConsumerId info = (ConsumerId)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalString(info.getConnectionId(), dataOut); + looseMarshalLong(wireFormat, info.getSessionId(), dataOut); + looseMarshalLong(wireFormat, info.getValue(), dataOut); + + } +} Propchange: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java ------------------------------------------------------------------------------ svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java?rev=1097189&view=auto ============================================================================== --- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java (added) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java Wed Apr 27 17:32:51 2011 @@ -0,0 +1,242 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.apollo.openwire.codec.v1; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import org.apache.activemq.apollo.filter.BooleanExpression; +import org.apache.activemq.apollo.openwire.command.ConsumerInfo; +import org.apache.activemq.apollo.openwire.command.DataStructure; +import org.apache.activemq.apollo.openwire.codec.BooleanStream; +import org.apache.activemq.apollo.openwire.codec.OpenWireFormat; + +/** + * Marshalling code for Open Wire Format for ConsumerInfoMarshaller + * + * + * NOTE!: This file is auto generated - do not modify! if you need to make a + * change, please see the modify the groovy scripts in the under src/gram/script + * and then use maven openwire:generate to regenerate this file. + * + */ +public class ConsumerInfoMarshaller extends BaseCommandMarshaller { + + /** + * Return the type of Data Structure we marshal + * + * @return short representation of the type data structure + */ + public byte getDataStructureType() { + return ConsumerInfo.DATA_STRUCTURE_TYPE; + } + + /** + * @return a new object instance + */ + public DataStructure createObject() { + return new ConsumerInfo(); + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) + throws IOException { + super.tightUnmarshal(wireFormat, o, dataIn, bs); + + ConsumerInfo info = (ConsumerInfo)o; + info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId)tightUnmarsalCachedObject(wireFormat, + dataIn, bs)); + info.setBrowser(bs.readBoolean()); + info + .setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)tightUnmarsalCachedObject( + wireFormat, + dataIn, + bs)); + info.setPrefetchSize(dataIn.readInt()); + info.setMaximumPendingMessageLimit(dataIn.readInt()); + info.setDispatchAsync(bs.readBoolean()); + info.setSelector(tightUnmarshalString(dataIn, bs)); + info.setSubscriptionName(tightUnmarshalString(dataIn, bs)); + info.setNoLocal(bs.readBoolean()); + info.setExclusive(bs.readBoolean()); + info.setRetroactive(bs.readBoolean()); + info.setPriority(dataIn.readByte()); + + if (bs.readBoolean()) { + short size = dataIn.readShort(); + org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size]; + for (int i = 0; i < size; i++) { + value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalNestedObject(wireFormat, + dataIn, bs); + } + info.setBrokerPath(value); + } else { + info.setBrokerPath(null); + } + info + .setAdditionalPredicate((BooleanExpression)tightUnmarsalNestedObject( + wireFormat, + dataIn, + bs)); + info.setNetworkSubscription(bs.readBoolean()); + info.setOptimizedAcknowledge(bs.readBoolean()); + info.setNoRangeAcks(bs.readBoolean()); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { + + ConsumerInfo info = (ConsumerInfo)o; + + int rc = super.tightMarshal1(wireFormat, o, bs); + rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs); + bs.writeBoolean(info.isBrowser()); + rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); + bs.writeBoolean(info.isDispatchAsync()); + rc += tightMarshalString1(info.getSelector(), bs); + rc += tightMarshalString1(info.getSubscriptionName(), bs); + bs.writeBoolean(info.isNoLocal()); + bs.writeBoolean(info.isExclusive()); + bs.writeBoolean(info.isRetroactive()); + rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); + rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getAdditionalPredicate(), bs); + bs.writeBoolean(info.isNetworkSubscription()); + bs.writeBoolean(info.isOptimizedAcknowledge()); + bs.writeBoolean(info.isNoRangeAcks()); + + return rc + 9; + } + + /** + * Write a object instance to data output stream + * + * @param o the instance to be marshaled + * @param dataOut the output stream + * @throws IOException thrown if an error occurs + */ + public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) + throws IOException { + super.tightMarshal2(wireFormat, o, dataOut, bs); + + ConsumerInfo info = (ConsumerInfo)o; + tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs); + bs.readBoolean(); + tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); + dataOut.writeInt(info.getPrefetchSize()); + dataOut.writeInt(info.getMaximumPendingMessageLimit()); + bs.readBoolean(); + tightMarshalString2(info.getSelector(), dataOut, bs); + tightMarshalString2(info.getSubscriptionName(), dataOut, bs); + bs.readBoolean(); + bs.readBoolean(); + bs.readBoolean(); + dataOut.writeByte(info.getPriority()); + tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); + tightMarshalNestedObject2(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut, bs); + bs.readBoolean(); + bs.readBoolean(); + bs.readBoolean(); + + } + + /** + * Un-marshal an object instance from the data input stream + * + * @param o the object to un-marshal + * @param dataIn the data input stream to build the object from + * @throws IOException + */ + public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { + super.looseUnmarshal(wireFormat, o, dataIn); + + ConsumerInfo info = (ConsumerInfo)o; + info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId)looseUnmarsalCachedObject(wireFormat, + dataIn)); + info.setBrowser(dataIn.readBoolean()); + info + .setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)looseUnmarsalCachedObject( + wireFormat, + dataIn)); + info.setPrefetchSize(dataIn.readInt()); + info.setMaximumPendingMessageLimit(dataIn.readInt()); + info.setDispatchAsync(dataIn.readBoolean()); + info.setSelector(looseUnmarshalString(dataIn)); + info.setSubscriptionName(looseUnmarshalString(dataIn)); + info.setNoLocal(dataIn.readBoolean()); + info.setExclusive(dataIn.readBoolean()); + info.setRetroactive(dataIn.readBoolean()); + info.setPriority(dataIn.readByte()); + + if (dataIn.readBoolean()) { + short size = dataIn.readShort(); + org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size]; + for (int i = 0; i < size; i++) { + value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn); + } + info.setBrokerPath(value); + } else { + info.setBrokerPath(null); + } + info + .setAdditionalPredicate((BooleanExpression)looseUnmarsalNestedObject( + wireFormat, + dataIn)); + info.setNetworkSubscription(dataIn.readBoolean()); + info.setOptimizedAcknowledge(dataIn.readBoolean()); + info.setNoRangeAcks(dataIn.readBoolean()); + + } + + /** + * Write the booleans that this object uses to a BooleanStream + */ + public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { + + ConsumerInfo info = (ConsumerInfo)o; + + super.looseMarshal(wireFormat, o, dataOut); + looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); + dataOut.writeBoolean(info.isBrowser()); + looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); + dataOut.writeInt(info.getPrefetchSize()); + dataOut.writeInt(info.getMaximumPendingMessageLimit()); + dataOut.writeBoolean(info.isDispatchAsync()); + looseMarshalString(info.getSelector(), dataOut); + looseMarshalString(info.getSubscriptionName(), dataOut); + dataOut.writeBoolean(info.isNoLocal()); + dataOut.writeBoolean(info.isExclusive()); + dataOut.writeBoolean(info.isRetroactive()); + dataOut.writeByte(info.getPriority()); + looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); + looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); + dataOut.writeBoolean(info.isNetworkSubscription()); + dataOut.writeBoolean(info.isOptimizedAcknowledge()); + dataOut.writeBoolean(info.isNoRangeAcks()); + + } +}