You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2015/12/01 20:17:36 UTC
[17/41] activemq-openwire git commit: OPENWIRE-19
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/builtin/UniversalMarshallerGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/builtin/UniversalMarshallerGenerator.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/builtin/UniversalMarshallerGenerator.java
new file mode 100644
index 0000000..2d0bec4
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/builtin/UniversalMarshallerGenerator.java
@@ -0,0 +1,660 @@
+/*
+ * 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.openwire.generator.builtin;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.activemq.openwire.generator.AbstractGenerator;
+import org.apache.activemq.openwire.generator.GeneratorUtils;
+import org.apache.activemq.openwire.generator.OpenWirePropertyDescriptor;
+import org.apache.activemq.openwire.generator.OpenWireTypeDescriptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Generator that create a set of OpenWire command marshalers that can
+ * handle all OpenWire versions.
+ */
+public class UniversalMarshallerGenerator extends AbstractGenerator {
+
+ private static final Logger LOG = LoggerFactory.getLogger(UniversalMarshallerGenerator.class);
+
+ private final String codecBase = "org.apache.activemq.openwire.codec";
+ private final String codecPackage = codecBase + ".universal";
+
+ @Override
+ public void run(List<OpenWireTypeDescriptor> typeDescriptors) throws Exception {
+ final File outputFolder = GeneratorUtils.createDestination(getBaseDir(), codecPackage);
+ LOG.info("Output location for generated marshalers is: {}", outputFolder.getAbsolutePath());
+
+ for (final OpenWireTypeDescriptor openWireType : typeDescriptors) {
+ LOG.debug("Generating marshaller for type: {}", openWireType.getTypeName());
+ processClass(openWireType, outputFolder);
+ }
+ }
+
+ /**
+ * @return the base codec package name where the OpenWire marshalers support code lives.
+ */
+ public String getCodecPackageBase() {
+ return codecBase;
+ }
+
+ /**
+ * @return the package name where the OpenWire marshalers are written.
+ */
+ public String getCodecPackage() {
+ return codecPackage;
+ }
+
+ //----- Implementation ---------------------------------------------------//
+
+ protected void processClass(OpenWireTypeDescriptor openWireType, File outputFolder) throws Exception {
+ final File marshalerFile = new File(outputFolder, getClassName(openWireType) + ".java");
+
+ try (PrintWriter out = new PrintWriter(new FileWriter(marshalerFile));) {
+ LOG.debug("Output file: {}", marshalerFile.getAbsolutePath());
+ writeApacheLicense(out);
+ writePreamble(out, openWireType);
+ writeClassDefinition(out, openWireType);
+ writeTypeSupportMethods(out, openWireType);
+
+ writeTightUnmarshal(out, openWireType);
+ writeTightMarshal1(out, openWireType);
+ writeTightMarshal2(out, openWireType);
+
+ writeLooseMarshal(out, openWireType);
+ writeLooseUnmarshal(out, openWireType);
+
+ writeClassClosure(out, openWireType);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void writePreamble(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println("package " + getCodecPackage() + ";");
+ out.println("");
+
+ Set<String> languageTypes = new HashSet<String>();
+
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ final Class<?> type = property.getType();
+ if (type.getCanonicalName().startsWith("java.util")) {
+ languageTypes.add(type.getCanonicalName());
+ } else if (type.getCanonicalName().startsWith("org.fusesource.")) {
+ languageTypes.add(type.getCanonicalName());
+ }
+ }
+
+ for (String languageType : languageTypes) {
+ out.println("import " + languageType + ";");
+ }
+ out.println("import java.io.DataInput;");
+ out.println("import java.io.DataOutput;");
+ out.println("import java.io.IOException;");
+ out.println("");
+ out.println("import " + getCodecPackageBase() + ".*;");
+ out.println("import " + openWireType.getPackageName() + ".*;");
+ out.println("");
+ }
+
+ private void writeClassDefinition(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ final String abstractModifier = openWireType.isAbstract() ? "abstract " : "";
+ final String className = getClassName(openWireType);
+ final String baseClassName = getBaseClassName(openWireType);
+
+ out.println("/**");
+ out.println(" * Marshalling code for Open Wire for " + openWireType.getTypeName() + "");
+ out.println(" *");
+ out.println(" * NOTE!: This file is auto generated - do not modify!");
+ out.println(" *");
+ out.println(" */");
+ out.println("public " + abstractModifier + "class " + className + " extends " + baseClassName + " {");
+ out.println("");
+ }
+
+ private void writeTypeSupportMethods(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ if (!openWireType.isAbstract()) {
+ out.println(" /**");
+ out.println(" * Return the type of Data Structure handled by this Marshaler");
+ out.println(" *");
+ out.println(" * @return short representation of the type data structure");
+ out.println(" */");
+ out.println(" public byte getDataStructureType() {");
+ out.println(" return " + openWireType.getTypeName() + ".DATA_STRUCTURE_TYPE;");
+ out.println(" }");
+ out.println(" ");
+ out.println(" /**");
+ out.println(" * @return a new instance of the managed type.");
+ out.println(" */");
+ out.println(" public DataStructure createObject() {");
+ out.println(" return new " + openWireType.getTypeName() + "();");
+ out.println(" }");
+ out.println("");
+ }
+ }
+
+ private void writeTightUnmarshal(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println(" /**");
+ out.println(" * Un-marshal an object instance from the data input stream");
+ out.println(" *");
+ out.println(" * @param wireFormat the OpenWireFormat instance to use");
+ out.println(" * @param target the object to un-marshal");
+ out.println(" * @param dataIn the data input stream to build the object from");
+ out.println(" * @param bs the boolean stream where the type's booleans were marshaled");
+ out.println(" *");
+ out.println(" * @throws IOException if an error occurs while reading the data");
+ out.println(" */");
+ out.println(" public void tightUnmarshal(OpenWireFormat wireFormat, Object target, DataInput dataIn, BooleanStream bs) throws IOException {");
+ out.println(" super.tightUnmarshal(wireFormat, target, dataIn, bs);");
+
+ if (openWireType.hasProperties()) {
+ out.println("");
+ out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") target;");
+ if (isOpenWireVersionNeeded(openWireType)) {
+ out.println(" int version = wireFormat.getVersion();");
+ }
+ out.println("");
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println(" info.beforeUnmarshall(wireFormat);");
+ }
+
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ final int size = property.getSize();
+ final String typeName = property.getTypeName();
+ final String setter = property.getSetterName();
+
+ String indent = " ";
+ if (property.getVersion() > 1) {
+ indent = indent + " ";
+ out.println(" if (version >= " + property.getVersion() + ") {");
+ }
+
+ if (property.isArray() && !typeName.equals("byte[]")) {
+ final String arrayType = property.getType().getComponentType().getSimpleName();
+
+ if (size > 0) {
+ out.println(indent + "{");
+ out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[" + size + "];");
+ out.println(indent + " " + "for (int i = 0; i < " + size + "; i++) {");
+ out.println(indent + " value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);");
+ out.println(indent + " }");
+ out.println(indent + " info." + setter + "(value);");
+ out.println(indent + "}");
+ } else {
+ out.println(indent + "if (bs.readBoolean()) {");
+ out.println(indent + " short size = dataIn.readShort();");
+ out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[size];");
+ out.println(indent + " for (int i = 0; i < size; i++) {");
+ out.println(indent + " value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);");
+ out.println(indent + " }");
+ out.println(indent + " info." + setter + "(value);");
+ out.println(indent + "} else {");
+ out.println(indent + " info." + setter + "(null);");
+ out.println(indent + "}");
+ }
+ } else {
+ if (typeName.equals("boolean")) {
+ out.println(indent + "info." + setter + "(bs.readBoolean());");
+ } else if (typeName.equals("byte")) {
+ out.println(indent + "info." + setter + "(dataIn.readByte());");
+ } else if (typeName.equals("char")) {
+ out.println(indent + "info." + setter + "(dataIn.readChar());");
+ } else if (typeName.equals("short")) {
+ out.println(indent + "info." + setter + "(dataIn.readShort());");
+ } else if (typeName.equals("int")) {
+ out.println(indent + "info." + setter + "(dataIn.readInt());");
+ } else if (typeName.equals("long")) {
+ out.println(indent + "info." + setter + "(tightUnmarshalLong(wireFormat, dataIn, bs));");
+ } else if (typeName.equals("String")) {
+ out.println(indent + "info." + setter + "(tightUnmarshalString(dataIn, bs));");
+ } else if (typeName.equals("byte[]")) {
+ if (size >= 0) {
+ out.println(indent + "info." + setter + "(tightUnmarshalConstByteArray(dataIn, bs, " + size + "));");
+ } else {
+ out.println(indent + "info." + setter + "(tightUnmarshalByteArray(dataIn, bs));");
+ }
+ } else if (typeName.equals("Buffer")) {
+ out.println(indent + "info." + setter + "(tightUnmarshalByteSequence(dataIn, bs));");
+ } else if (property.isThrowable()) {
+ out.println(indent + "info." + setter + "((" + property.getTypeName() + ") tightUnmarsalThrowable(wireFormat, dataIn, bs));");
+ } else if (property.isCached()) {
+ out.println(indent + "info." + setter + "((" + property.getTypeName() + ") tightUnmarsalCachedObject(wireFormat, dataIn, bs));");
+ } else {
+ out.println(indent + "info." + setter + "((" + property.getTypeName() + ") tightUnmarsalNestedObject(wireFormat, dataIn, bs));");
+ }
+ }
+
+ if (property.getVersion() > 1) {
+ out.println(" }");
+ }
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println("");
+ out.println(" info.afterUnmarshall(wireFormat);");
+ }
+
+ out.println(" }");
+ out.println("");
+ }
+
+ private void writeTightMarshal1(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println(" /**");
+ out.println(" * Write the booleans that this object uses to a BooleanStream");
+ out.println(" *");
+ out.println(" * @param wireFormat the OpenWireFormat instance to use");
+ out.println(" * @param source the object to marshal");
+ out.println(" * @param bs the boolean stream where the type's booleans are written");
+ out.println(" *");
+ out.println(" * @throws IOException if an error occurs while writing the data");
+ out.println(" */");
+ out.println(" public int tightMarshal1(OpenWireFormat wireFormat, Object source, BooleanStream bs) throws IOException {");
+
+ if (openWireType.hasProperties()) {
+ out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") source;");
+ if (isOpenWireVersionNeeded(openWireType)) {
+ out.println(" int version = wireFormat.getVersion();");
+ }
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println("");
+ out.println(" info.beforeMarshall(wireFormat);");
+ }
+
+ out.println("");
+ out.println(" int rc = super.tightMarshal1(wireFormat, source, bs);");
+
+ int baseSize = 0;
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ final int size = property.getSize();
+ final String typeName = property.getTypeName();
+ final String getter = "info." + property.getGetterName() + "()";
+
+ String indent = " ";
+ if (property.getVersion() > 1) {
+ indent = indent + " ";
+ out.println(" if (version >= " + property.getVersion() + ") {");
+ }
+
+ if (typeName.equals("boolean")) {
+ out.println(indent + "bs.writeBoolean(" + getter + ");");
+ } else if (typeName.equals("byte")) {
+ baseSize += 1;
+ } else if (typeName.equals("char")) {
+ baseSize += 2;
+ } else if (typeName.equals("short")) {
+ baseSize += 2;
+ } else if (typeName.equals("int")) {
+ baseSize += 4;
+ } else if (typeName.equals("long")) {
+ out.println(indent + "rc += tightMarshalLong1(wireFormat, " + getter + ", bs);");
+ } else if (typeName.equals("String")) {
+ out.println(indent + "rc += tightMarshalString1(" + getter + ", bs);");
+ } else if (typeName.equals("byte[]")) {
+ if (size > 0) {
+ out.println(indent + "rc += tightMarshalConstByteArray1(" + getter + ", bs, " + size + ");");
+ } else {
+ out.println(indent + "rc += tightMarshalByteArray1(" + getter + ", bs);");
+ }
+ } else if (typeName.equals("Buffer")) {
+ out.println(indent + "rc += tightMarshalByteSequence1(" + getter + ", bs);");
+ } else if (property.isArray()) {
+ if (size > 0) {
+ out.println(indent + "rc += tightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size + ");");
+ } else {
+ out.println(indent + "rc += tightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
+ }
+ } else if (property.isThrowable()) {
+ out.println(indent + "rc += tightMarshalThrowable1(wireFormat, " + getter + ", bs);");
+ } else {
+ if (property.isCached()) {
+ out.println(indent + "rc += tightMarshalCachedObject1(wireFormat, (DataStructure)" + getter + ", bs);");
+ } else {
+ out.println(indent + "rc += tightMarshalNestedObject1(wireFormat, (DataStructure)" + getter + ", bs);");
+ }
+ }
+
+ if (property.getVersion() > 1) {
+ out.println(" }");
+ }
+ }
+
+ out.println("");
+ out.println(" return rc + " + baseSize + ";");
+ out.println(" }");
+ out.println("");
+ }
+
+ private void writeTightMarshal2(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println(" /**");
+ out.println(" * Write a object instance to data output stream");
+ out.println(" *");
+ out.println(" * @param wireFormat the OpenWireFormat instance to use");
+ out.println(" * @param source the object to marshal");
+ out.println(" * @param dataOut the DataOut where the properties are written");
+ out.println(" * @param bs the boolean stream where the type's booleans are written");
+ out.println(" *");
+ out.println(" * @throws IOException if an error occurs while writing the data");
+ out.println(" */");
+ out.println(" public void tightMarshal2(OpenWireFormat wireFormat, Object source, DataOutput dataOut, BooleanStream bs) throws IOException {");
+ out.println(" super.tightMarshal2(wireFormat, source, dataOut, bs);");
+
+ if (openWireType.hasProperties()) {
+ out.println("");
+ out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") source;");
+ if (isOpenWireVersionNeeded(openWireType)) {
+ out.println(" int version = wireFormat.getVersion();");
+ }
+ out.println("");
+ }
+
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ final int size = property.getSize();
+ final String typeName = property.getTypeName();
+ final String getter = "info." + property.getGetterName() + "()";
+
+ String indent = " ";
+ if (property.getVersion() > 1) {
+ indent = indent + " ";
+ out.println(" if (version >= " + property.getVersion() + ") {");
+ }
+
+ if (typeName.equals("boolean")) {
+ out.println(indent + "bs.readBoolean();");
+ } else if (typeName.equals("byte")) {
+ out.println(indent + "dataOut.writeByte(" + getter + ");");
+ } else if (typeName.equals("char")) {
+ out.println(indent + "dataOut.writeChar(" + getter + ");");
+ } else if (typeName.equals("short")) {
+ out.println(indent + "dataOut.writeShort(" + getter + ");");
+ } else if (typeName.equals("int")) {
+ out.println(indent + "dataOut.writeInt(" + getter + ");");
+ } else if (typeName.equals("long")) {
+ out.println(indent + "tightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);");
+ } else if (typeName.equals("String")) {
+ out.println(indent + "tightMarshalString2(" + getter + ", dataOut, bs);");
+ } else if (typeName.equals("byte[]")) {
+ if (size > 0) {
+ out.println(indent + "tightMarshalConstByteArray2(" + getter + ", dataOut, bs, " + size + ");");
+ } else {
+ out.println(indent + "tightMarshalByteArray2(" + getter + ", dataOut, bs);");
+ }
+ } else if (typeName.equals("Buffer")) {
+ out.println(indent + "tightMarshalByteSequence2(" + getter + ", dataOut, bs);");
+ } else if (property.isArray()) {
+ if (size > 0) {
+ out.println(indent + "tightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size + ");");
+ } else {
+ out.println(indent + "tightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);");
+ }
+ } else if (property.isThrowable()) {
+ out.println(indent + "tightMarshalThrowable2(wireFormat, " + getter + ", dataOut, bs);");
+ } else {
+ if (property.isCached()) {
+ out.println(indent + "tightMarshalCachedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);");
+ } else {
+ out.println(indent + "tightMarshalNestedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);");
+ }
+ }
+
+ if (property.getVersion() > 1) {
+ out.println(" }");
+ }
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println("");
+ out.println(" info.afterMarshall(wireFormat);");
+ }
+
+ out.println(" }");
+ out.println("");
+ }
+
+ private void writeLooseUnmarshal(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println(" /**");
+ out.println(" * Un-marshal an object instance from the data input stream");
+ out.println(" *");
+ out.println(" * @param target the object to un-marshal");
+ out.println(" * @param dataIn the data input stream to build the object from");
+ out.println(" *");
+ out.println(" * @throws IOException if an error occurs while writing the data");
+ out.println(" */");
+ out.println(" public void looseUnmarshal(OpenWireFormat wireFormat, Object target, DataInput dataIn) throws IOException {");
+ out.println(" super.looseUnmarshal(wireFormat, target, dataIn);");
+
+ if (openWireType.hasProperties()) {
+ out.println("");
+ out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") target;");
+ if (isOpenWireVersionNeeded(openWireType)) {
+ out.println(" int version = wireFormat.getVersion();");
+ }
+ out.println("");
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println(" info.beforeUnmarshall(wireFormat);");
+ }
+
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ final int size = property.getSize();
+ final String typeName = property.getTypeName();
+ final String setter = property.getSetterName();
+
+ String indent = " ";
+ if (property.getVersion() > 1) {
+ indent = indent + " ";
+ out.println(" if (version >= " + property.getVersion() + ") {");
+ }
+
+ if (property.isArray() && !typeName.equals("byte[]")) {
+ final String arrayType = property.getType().getComponentType().getSimpleName();
+
+ if (size > 0) {
+ out.println(indent + "{");
+ out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[" + size + "];");
+ out.println(indent + " " + "for (int i = 0; i < " + size + "; i++) {");
+ out.println(indent + " value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);");
+ out.println(indent + " }");
+ out.println(indent + " info." + setter + "(value);");
+ out.println(indent + "}");
+ } else {
+ out.println(indent + "if (dataIn.readBoolean()) {");
+ out.println(indent + " short size = dataIn.readShort();");
+ out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[size];");
+ out.println(indent + " for (int i = 0; i < size; i++) {");
+ out.println(indent + " value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);");
+ out.println(indent + " }");
+ out.println(indent + " info." + setter + "(value);");
+ out.println(indent + "} else {");
+ out.println(indent + " info." + setter + "(null);");
+ out.println(indent + "}");
+ }
+ } else {
+ if (typeName.equals("boolean")) {
+ out.println(indent + "info." + setter + "(dataIn.readBoolean());");
+ } else if (typeName.equals("byte")) {
+ out.println(indent + "info." + setter + "(dataIn.readByte());");
+ } else if (typeName.equals("char")) {
+ out.println(indent + "info." + setter + "(dataIn.readChar());");
+ } else if (typeName.equals("short")) {
+ out.println(indent + "info." + setter + "(dataIn.readShort());");
+ } else if (typeName.equals("int")) {
+ out.println(indent + "info." + setter + "(dataIn.readInt());");
+ } else if (typeName.equals("long")) {
+ out.println(indent + "info." + setter + "(looseUnmarshalLong(wireFormat, dataIn));");
+ } else if (typeName.equals("String")) {
+ out.println(indent + "info." + setter + "(looseUnmarshalString(dataIn));");
+ } else if (typeName.equals("byte[]")) {
+ if (size > 0) {
+ out.println(indent + "info." + setter + "(looseUnmarshalConstByteArray(dataIn, " + size + "));");
+ } else {
+ out.println(indent + "info." + setter + "(looseUnmarshalByteArray(dataIn));");
+ }
+ } else if (typeName.equals("Buffer")) {
+ out.println(indent + "info." + setter + "(looseUnmarshalByteSequence(dataIn));");
+ } else if (property.isThrowable()) {
+ out.println(indent + "info." + setter + "((" + typeName + ") looseUnmarsalThrowable(wireFormat, dataIn));");
+ } else if (property.isCached()) {
+ out.println(indent + "info." + setter + "((" + typeName + ") looseUnmarsalCachedObject(wireFormat, dataIn));");
+ } else {
+ out.println(indent + "info." + setter + "((" + typeName + ") looseUnmarsalNestedObject(wireFormat, dataIn));");
+ }
+ }
+
+ if (property.getVersion() > 1) {
+ out.println(" }");
+ }
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println("");
+ out.println(" info.afterUnmarshall(wireFormat);");
+ }
+
+ out.println(" }");
+ }
+
+ private void writeLooseMarshal(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println(" /**");
+ out.println(" * Write the object to the output using loose marshaling.");
+ out.println(" *");
+ out.println(" * @throws IOException if an error occurs while writing the data");
+ out.println(" */");
+ out.println(" public void looseMarshal(OpenWireFormat wireFormat, Object source, DataOutput dataOut) throws IOException {");
+
+ if (openWireType.hasProperties()) {
+ out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") source;");
+ if (isOpenWireVersionNeeded(openWireType)) {
+ out.println(" int version = wireFormat.getVersion();");
+ }
+ out.println("");
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println(" info.beforeMarshall(wireFormat);");
+ }
+
+ out.println(" super.looseMarshal(wireFormat, source, dataOut);");
+
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ final int size = property.getSize();
+ final String typeName = property.getTypeName();
+ final String getter = "info." + property.getGetterName() + "()";
+
+ String indent = " ";
+ if (property.getVersion() > 1) {
+ indent = indent + " ";
+ out.println(" if (version >= " + property.getVersion() + ") {");
+ }
+
+ if (typeName.equals("boolean")) {
+ out.println(indent + "dataOut.writeBoolean(" + getter + ");");
+ } else if (typeName.equals("byte")) {
+ out.println(indent + "dataOut.writeByte(" + getter + ");");
+ } else if (typeName.equals("char")) {
+ out.println(indent + "dataOut.writeChar(" + getter + ");");
+ } else if (typeName.equals("short")) {
+ out.println(indent + "dataOut.writeShort(" + getter + ");");
+ } else if (typeName.equals("int")) {
+ out.println(indent + "dataOut.writeInt(" + getter + ");");
+ } else if (typeName.equals("long")) {
+ out.println(indent + "looseMarshalLong(wireFormat, " + getter + ", dataOut);");
+ } else if (typeName.equals("String")) {
+ out.println(indent + "looseMarshalString(" + getter + ", dataOut);");
+ } else if (typeName.equals("byte[]")) {
+ if (size > 0) {
+ out.println(indent + "looseMarshalConstByteArray(wireFormat, " + getter + ", dataOut, " + size + ");");
+ } else {
+ out.println(indent + "looseMarshalByteArray(wireFormat, " + getter + ", dataOut);");
+ }
+ } else if (typeName.equals("Buffer")) {
+ out.println(indent + "looseMarshalByteSequence(wireFormat, " + getter + ", dataOut);");
+ } else if (property.isArray()) {
+ if (size > 0) {
+ out.println(indent + "looseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size + ");");
+ } else {
+ out.println(indent + "looseMarshalObjectArray(wireFormat, " + getter + ", dataOut);");
+ }
+ } else if (property.isThrowable()) {
+ out.println(indent + "looseMarshalThrowable(wireFormat, " + getter + ", dataOut);");
+ } else {
+ if (property.isCached()) {
+ out.println(indent + "looseMarshalCachedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+ } else {
+ out.println(indent + "looseMarshalNestedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+ }
+ }
+
+ if (property.getVersion() > 1) {
+ out.println(" }");
+ }
+ }
+
+ if (openWireType.isMarshalAware()) {
+ out.println("");
+ out.println(" info.afterMarshall(wireFormat);");
+ }
+
+ out.println(" }");
+ out.println("");
+ }
+
+ private void writeClassClosure(PrintWriter out, OpenWireTypeDescriptor openWireType) {
+ out.println("}");
+ }
+
+ //----- Helper Methods for Code Generation -------------------------------//
+
+ private boolean isOpenWireVersionNeeded(OpenWireTypeDescriptor openWireType) {
+ for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) {
+ if (property.getVersion() > 1) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private String getClassName(OpenWireTypeDescriptor openWireType) {
+ return openWireType.getTypeName() + "Marshaller";
+ }
+
+ private String getBaseClassName(OpenWireTypeDescriptor openWireType) {
+ String answer = "BaseDataStreamMarshaller";
+
+ final String superName = openWireType.getSuperClass();
+ if (!superName.equals("Object") &&
+ !superName.equals("JNDIBaseStorable") &&
+ !superName.equals("DataStructureSupport")) {
+
+ answer = superName + "Marshaller";
+ }
+
+ return answer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-generator/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/resources/log4j.properties b/openwire-generator/src/main/resources/log4j.properties
new file mode 100644
index 0000000..5da64b0
--- /dev/null
+++ b/openwire-generator/src/main/resources/log4j.properties
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, out, stdout
+
+log4j.logger.org.apache.activemq.openwire=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/activemq-test.log
+log4j.appender.out.append=true
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-generator/src/test/java/org/apache/activenq/openwire/generator/IDERunner.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/test/java/org/apache/activenq/openwire/generator/IDERunner.java b/openwire-generator/src/test/java/org/apache/activenq/openwire/generator/IDERunner.java
new file mode 100644
index 0000000..cc2a16b
--- /dev/null
+++ b/openwire-generator/src/test/java/org/apache/activenq/openwire/generator/IDERunner.java
@@ -0,0 +1,34 @@
+/*
+ * 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.activenq.openwire.generator;
+
+import org.apache.activemq.openwire.generator.GeneratorTask;
+
+/**
+ * Runs the Generator Task from the IDE, output to target.
+ */
+public class IDERunner {
+
+ public static void main(String[] args) throws Exception {
+
+ GeneratorTask task = new GeneratorTask();
+
+ task.setBaseDir("./target/generated-sources/openwire");
+
+ task.execute();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-interop-tests/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/pom.xml b/openwire-interop-tests/pom.xml
index be6174f..0a8ff01 100644
--- a/openwire-interop-tests/pom.xml
+++ b/openwire-interop-tests/pom.xml
@@ -43,11 +43,15 @@
<groupId>org.apache.activemq</groupId>
<artifactId>openwire-legacy</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.fusesource.hawtbuf</groupId>
+ <artifactId>hawtbuf</artifactId>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -58,10 +62,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.fusesource.hawtbuf</groupId>
- <artifactId>hawtbuf</artifactId>
- </dependency>
<!-- Pull in ActiveMQ for compatibility testing -->
<dependency>
@@ -76,18 +76,6 @@
<version>${activemq-version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-jaas</artifactId>
- <version>${activemq-version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-spring</artifactId>
- <version>${activemq-version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-legacy/pom.xml b/openwire-legacy/pom.xml
index 8d61ac9..f5b974d 100644
--- a/openwire-legacy/pom.xml
+++ b/openwire-legacy/pom.xml
@@ -40,10 +40,6 @@
<artifactId>openwire-core</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
<groupId>org.fusesource.hawtbuf</groupId>
<artifactId>hawtbuf</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java
new file mode 100644
index 0000000..ea3a3f3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java
@@ -0,0 +1,109 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller;
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.BaseCommand;
+
+public abstract class BaseCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * 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
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ BaseCommand info = (BaseCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setResponseRequired(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ BaseCommand info = (BaseCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ bs.writeBoolean(info.isResponseRequired());
+
+ 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
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ BaseCommand info = (BaseCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ 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
+ */
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ BaseCommand info = (BaseCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setResponseRequired(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ BaseCommand info = (BaseCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ dataOut.writeBoolean(info.isResponseRequired());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java
new file mode 100644
index 0000000..43e4154
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java
@@ -0,0 +1,118 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller;
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.BrokerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class BrokerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return BrokerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ BrokerId info = (BrokerId) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..e89e8f7
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java
@@ -0,0 +1,175 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.BrokerId;
+import org.apache.activemq.openwire.commands.BrokerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class BrokerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return BrokerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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((BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrokerURL(tightUnmarshalString(dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerInfo value[] = new BrokerInfo[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (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
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ BrokerInfo info = (BrokerInfo) o;
+ info.setBrokerId((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrokerURL(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerInfo value[] = new BrokerInfo[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (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
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ BrokerInfo info = (BrokerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, 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());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..330f450
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java
@@ -0,0 +1,144 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConnectionControl;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ConnectionControlMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConnectionControl.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..73b3c8c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java
@@ -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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConnectionError;
+import org.apache.activemq.openwire.commands.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ConnectionErrorMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConnectionError.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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(tightUnmarsalThrowable(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ ConnectionError info = (ConnectionError) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ 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, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..0dab2a9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java
@@ -0,0 +1,124 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller;
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ConnectionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConnectionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConnectionId info = (ConnectionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..80258c7
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java
@@ -0,0 +1,189 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+/**
+ * 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
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConnectionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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.openwire.commands.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.openwire.commands.BrokerId value[] = new org.apache.activemq.openwire.commands.BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (org.apache.activemq.openwire.commands.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
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ 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.openwire.commands.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.openwire.commands.BrokerId value[] = new org.apache.activemq.openwire.commands.BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (org.apache.activemq.openwire.commands.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
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ ConnectionInfo info = (ConnectionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, 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());
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..4579843
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java
@@ -0,0 +1,148 @@
+/**
+ * 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.openwire.codec.v1;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConsumerControl;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+/**
+ * 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
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerControl.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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.openwire.commands.ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ 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, 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
+ */
+ @Override
+ 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.openwire.commands.ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ 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, info.getConsumerId(), dataOut);
+ dataOut.writeInt(info.getPrefetch());
+
+ }
+}