activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [50/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Date Thu, 24 Jul 2014 14:23:39 GMT
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireConstants.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireConstants.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireConstants.java
new file mode 100644
index 0000000..f1de32c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireConstants.java
@@ -0,0 +1,105 @@
+/**
+ * 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;
+
+/**
+ * Set of Constant values used by various OpenWire Brokers.
+ */
+public class OpenWireConstants {
+
+    //---------- ActiveMQ Message Extended Property Values -------------------//
+
+    public static final String DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = "dlqDeliveryFailureCause";
+
+    public static final String BROKER_PATH_PROPERTY = "JMSActiveMQBrokerPath";
+
+    //---------- ActiveMQ Advisory Message Identifiers -----------------------//
+
+    public static final String ADIVSORY_MESSAGE_TYPE = "Advisory";
+
+    //---------- ActiveMQ Scheduled Message Value ----------------------------//
+
+    /**
+     * The time in milliseconds that a message will wait before being scheduled to be
+     * delivered by the broker
+     */
+    public static final String AMQ_SCHEDULED_DELAY = "AMQ_SCHEDULED_DELAY";
+
+    /**
+     * The time in milliseconds to wait after the start time to wait before scheduling the message again
+     */
+    public static final String AMQ_SCHEDULED_PERIOD = "AMQ_SCHEDULED_PERIOD";
+
+    /**
+     * The number of times to repeat scheduling a message for delivery
+     */
+    public static final String AMQ_SCHEDULED_REPEAT = "AMQ_SCHEDULED_REPEAT";
+
+    /**
+     * Use a Cron tab entry to set the schedule
+     */
+    public static final String AMQ_SCHEDULED_CRON = "AMQ_SCHEDULED_CRON";
+
+    /**
+     * An Id that is assigned to a Scheduled Message, this value is only available once the
+     * Message is scheduled, Messages sent to the Browse Destination or delivered to the
+     * assigned Destination will have this value set.
+     */
+    public static final String AMQ_SCHEDULED_ID = "scheduledJobId";
+
+    /**
+     * Special destination to send Message's to with an assigned "action" that the Scheduler
+     * should perform such as removing a message.
+     */
+    public static final String AMQ_SCHEDULER_MANAGEMENT_DESTINATION = "ActiveMQ.Scheduler.Management";
+
+    /**
+     * Used to specify that a some operation should be performed on the Scheduled Message,
+     * the Message must have an assigned Id for this action to be taken.
+     */
+    public static final String AMQ_SCHEDULER_ACTION = "AMQ_SCHEDULER_ACTION";
+
+    /**
+     * Indicates that a browse of the Scheduled Messages is being requested.
+     */
+    public static final String AMQ_SCHEDULER_ACTION_BROWSE = "BROWSE";
+
+    /**
+     * Indicates that a Scheduled Message is to be remove from the Scheduler, the Id of
+     * the scheduled message must be set as a property in order for this action to have
+     * any effect.
+     */
+    public static final String AMQ_SCHEDULER_ACTION_REMOVE = "REMOVE";
+
+    /**
+     * Indicates that all scheduled Messages should be removed.
+     */
+    public static final String AMQ_SCHEDULER_ACTION_REMOVEALL = "REMOVEALL";
+
+    /**
+     * A property that holds the beginning of the time interval that the specified action should
+     * be applied within.  Maps to a long value that specified time in milliseconds since UTC.
+     */
+    public static final String AMQ_SCHEDULER_ACTION_START_TIME = "ACTION_START_TIME";
+
+    /**
+     * A property that holds the end of the time interval that the specified action should be
+     * applied within.  Maps to a long value that specified time in milliseconds since UTC.
+     */
+    public static final String AMQ_SCHEDULER_ACTION_END_TIME = "ACTION_END_TIME";
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormat.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormat.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormat.java
new file mode 100644
index 0000000..ceab954
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormat.java
@@ -0,0 +1,599 @@
+/**
+ * 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;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+
+/**
+ * The OpenWire Protocol Encoder and Decoder implementation.
+ */
+public final class OpenWireFormat {
+
+    public static final int DEFAULT_VERSION = CommandTypes.PROTOCOL_STORE_VERSION;
+    public static final int DEFAULT_WIRE_VERSION = CommandTypes.PROTOCOL_VERSION;
+    public static final long DEFAULT_MAX_FRAME_SIZE = Long.MAX_VALUE;
+
+    static final byte NULL_TYPE = CommandTypes.NULL;
+    private static final int MARSHAL_CACHE_SIZE = Short.MAX_VALUE / 2;
+    private static final int MARSHAL_CACHE_FREE_SPACE = 100;
+
+    private DataStreamMarshaller dataMarshallers[];
+    private int version;
+    private boolean stackTraceEnabled;
+    private boolean tcpNoDelayEnabled;
+    private boolean cacheEnabled;
+    private boolean tightEncodingEnabled;
+    private boolean sizePrefixDisabled;
+    private long maxFrameSize = DEFAULT_MAX_FRAME_SIZE;
+
+    // The following fields are used for value caching
+    private short nextMarshallCacheIndex;
+    private short nextMarshallCacheEvictionIndex;
+    private Map<DataStructure, Short> marshallCacheMap = new HashMap<DataStructure, Short>();
+    private DataStructure marshallCache[] = null;
+    private DataStructure unmarshallCache[] = null;
+    private final DataByteArrayOutputStream bytesOut = new DataByteArrayOutputStream();
+    private final DataByteArrayInputStream bytesIn = new DataByteArrayInputStream();
+    private WireFormatInfo preferedWireFormatInfo;
+
+    public OpenWireFormat() {
+        this(DEFAULT_VERSION);
+    }
+
+    public OpenWireFormat(int i) {
+        setVersion(i);
+    }
+
+    @Override
+    public int hashCode() {
+        return version ^ (cacheEnabled ? 0x10000000 : 0x20000000) ^ (stackTraceEnabled ? 0x01000000 : 0x02000000)
+            ^ (tightEncodingEnabled ? 0x00100000 : 0x00200000) ^ (sizePrefixDisabled ? 0x00010000 : 0x00020000);
+    }
+
+    public OpenWireFormat copy() {
+        OpenWireFormat answer = new OpenWireFormat(version);
+        answer.stackTraceEnabled = stackTraceEnabled;
+        answer.tcpNoDelayEnabled = tcpNoDelayEnabled;
+        answer.cacheEnabled = cacheEnabled;
+        answer.tightEncodingEnabled = tightEncodingEnabled;
+        answer.sizePrefixDisabled = sizePrefixDisabled;
+        answer.preferedWireFormatInfo = preferedWireFormatInfo;
+        return answer;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (object == null) {
+            return false;
+        }
+        OpenWireFormat o = (OpenWireFormat) object;
+        return o.stackTraceEnabled == stackTraceEnabled && o.cacheEnabled == cacheEnabled && o.version == version
+            && o.tightEncodingEnabled == tightEncodingEnabled && o.sizePrefixDisabled == sizePrefixDisabled;
+    }
+
+    @Override
+    public String toString() {
+        return "OpenWireFormat{version=" + version + ", cacheEnabled=" + cacheEnabled + ", stackTraceEnabled=" + stackTraceEnabled + ", tightEncodingEnabled="
+            + tightEncodingEnabled + ", sizePrefixDisabled=" + sizePrefixDisabled + ", maxFrameSize=" + maxFrameSize + "}";
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public synchronized Buffer marshal(Object command) throws IOException {
+        if (cacheEnabled) {
+            runMarshallCacheEvictionSweep();
+        }
+
+        Buffer sequence = null;
+        int size = 1;
+        if (command != null) {
+            DataStructure c = (DataStructure) command;
+            byte type = c.getDataStructureType();
+            DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + type);
+            }
+            if (tightEncodingEnabled) {
+
+                BooleanStream bs = new BooleanStream();
+                size += dsm.tightMarshal1(this, c, bs);
+                size += bs.marshalledSize();
+
+                bytesOut.restart(size);
+                if (!sizePrefixDisabled) {
+                    bytesOut.writeInt(size);
+                }
+                bytesOut.writeByte(type);
+                bs.marshal(bytesOut);
+                dsm.tightMarshal2(this, c, bytesOut, bs);
+                sequence = bytesOut.toBuffer();
+
+            } else {
+                bytesOut.restart();
+                if (!sizePrefixDisabled) {
+                    // we don't know the final size yet but write this here for now.
+                    bytesOut.writeInt(0);
+                }
+                bytesOut.writeByte(type);
+                dsm.looseMarshal(this, c, bytesOut);
+                sequence = bytesOut.toBuffer();
+
+                if (!sizePrefixDisabled) {
+                    size = sequence.getLength() - 4;
+                    int length = sequence.length;
+                    int offset = sequence.offset;
+                    sequence.bigEndianEditor().writeInt(size);
+                    sequence.length = length;
+                    sequence.offset = offset;
+                }
+            }
+        } else {
+            bytesOut.restart(5);
+            bytesOut.writeInt(size);
+            bytesOut.writeByte(NULL_TYPE);
+            sequence = bytesOut.toBuffer();
+        }
+
+        return sequence;
+    }
+
+    public synchronized Object unmarshal(Buffer sequence) throws IOException {
+        bytesIn.restart(sequence);
+
+        if (!sizePrefixDisabled) {
+            int size = bytesIn.readInt();
+            if (size > maxFrameSize) {
+                throw new IOException("Frame size of " + (size / (1024 * 1024)) + " MB larger than max allowed " + (maxFrameSize / (1024 * 1024)) + " MB");
+            }
+        }
+
+        Object command = doUnmarshal(bytesIn);
+        return command;
+    }
+
+    public synchronized void marshal(Object o, DataOutput dataOut) throws IOException {
+
+        if (cacheEnabled) {
+            runMarshallCacheEvictionSweep();
+        }
+
+        int size = 1;
+        if (o != null) {
+
+            DataStructure c = (DataStructure) o;
+            byte type = c.getDataStructureType();
+            DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + type);
+            }
+            if (tightEncodingEnabled) {
+                BooleanStream bs = new BooleanStream();
+                size += dsm.tightMarshal1(this, c, bs);
+                size += bs.marshalledSize();
+
+                if (!sizePrefixDisabled) {
+                    dataOut.writeInt(size);
+                }
+
+                dataOut.writeByte(type);
+                bs.marshal(dataOut);
+                dsm.tightMarshal2(this, c, dataOut, bs);
+
+            } else {
+                DataOutput looseOut = dataOut;
+
+                if (!sizePrefixDisabled) {
+                    bytesOut.restart();
+                    looseOut = bytesOut;
+                }
+
+                looseOut.writeByte(type);
+                dsm.looseMarshal(this, c, looseOut);
+
+                if (!sizePrefixDisabled) {
+                    Buffer sequence = bytesOut.toBuffer();
+                    dataOut.writeInt(sequence.getLength());
+                    dataOut.write(sequence.getData(), sequence.getOffset(), sequence.getLength());
+                }
+
+            }
+
+        } else {
+            if (!sizePrefixDisabled) {
+                dataOut.writeInt(size);
+            }
+            dataOut.writeByte(NULL_TYPE);
+        }
+    }
+
+    public Object unmarshal(DataInput dis) throws IOException {
+        DataInput dataIn = dis;
+        if (!sizePrefixDisabled) {
+            int size = dis.readInt();
+            if (size > maxFrameSize) {
+                throw new IOException("Frame size of " + (size / (1024 * 1024)) + " MB larger than max allowed " + (maxFrameSize / (1024 * 1024)) + " MB");
+            }
+        }
+        return doUnmarshal(dataIn);
+    }
+
+    /**
+     * Used by NIO or AIO transports
+     */
+    public int tightMarshal1(Object o, BooleanStream bs) throws IOException {
+        int size = 1;
+        if (o != null) {
+            DataStructure c = (DataStructure) o;
+            byte type = c.getDataStructureType();
+            DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + type);
+            }
+
+            size += dsm.tightMarshal1(this, c, bs);
+            size += bs.marshalledSize();
+        }
+        return size;
+    }
+
+    /**
+     * Used by NIO or AIO transports; note that the size is not written as part of this method.
+     */
+    public void tightMarshal2(Object o, DataOutput ds, BooleanStream bs) throws IOException {
+        if (cacheEnabled) {
+            runMarshallCacheEvictionSweep();
+        }
+
+        if (o != null) {
+            DataStructure c = (DataStructure) o;
+            byte type = c.getDataStructureType();
+            DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + type);
+            }
+            ds.writeByte(type);
+            bs.marshal(ds);
+            dsm.tightMarshal2(this, c, ds, bs);
+        }
+    }
+
+    /**
+     * Allows you to dynamically switch the version of the openwire protocol being used.
+     *
+     * @param version
+     */
+    public void setVersion(int version) {
+        String mfName = "org.apache.activemq.openwire.codec.v" + version + ".MarshallerFactory";
+        Class<?> mfClass;
+        try {
+            mfClass = Class.forName(mfName, false, getClass().getClassLoader());
+        } catch (ClassNotFoundException e) {
+            throw new IllegalArgumentException("Invalid version: " + version + ", could not load " + mfName, e);
+        }
+        try {
+            Method method = mfClass.getMethod("createMarshallerMap", new Class[] { OpenWireFormat.class });
+            dataMarshallers = (DataStreamMarshaller[]) method.invoke(null, new Object[] { this });
+        } catch (Throwable e) {
+            throw new IllegalArgumentException("Invalid version: " + version + ", " + mfName
+                + " does not properly implement the createMarshallerMap method.", e);
+        }
+        this.version = version;
+    }
+
+    public Object doUnmarshal(DataInput dis) throws IOException {
+        byte dataType = dis.readByte();
+        if (dataType != NULL_TYPE) {
+            DataStreamMarshaller dsm = dataMarshallers[dataType & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + dataType);
+            }
+            Object data = dsm.createObject();
+            if (this.tightEncodingEnabled) {
+                BooleanStream bs = new BooleanStream();
+                bs.unmarshal(dis);
+                dsm.tightUnmarshal(this, data, dis, bs);
+            } else {
+                dsm.looseUnmarshal(this, data, dis);
+            }
+            return data;
+        } else {
+            return null;
+        }
+    }
+
+    public int tightMarshalNestedObject1(DataStructure o, BooleanStream bs) throws IOException {
+        bs.writeBoolean(o != null);
+        if (o == null) {
+            return 0;
+        }
+
+        if (o.isMarshallAware()) {
+            // Legacy code, always writes false
+            Buffer sequence = null;
+            bs.writeBoolean(sequence != null);
+        }
+
+        byte type = o.getDataStructureType();
+        DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+        if (dsm == null) {
+            throw new IOException("Unknown data type: " + type);
+        }
+        return 1 + dsm.tightMarshal1(this, o, bs);
+    }
+
+    public void tightMarshalNestedObject2(DataStructure o, DataOutput ds, BooleanStream bs) throws IOException {
+        if (!bs.readBoolean()) {
+            return;
+        }
+
+        byte type = o.getDataStructureType();
+        ds.writeByte(type);
+
+        if (o.isMarshallAware() && bs.readBoolean()) {
+            // We should not be doing any caching
+            throw new IOException("Corrupted stream");
+        } else {
+            DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + type);
+            }
+            dsm.tightMarshal2(this, o, ds, bs);
+        }
+    }
+
+    public DataStructure tightUnmarshalNestedObject(DataInput dis, BooleanStream bs) throws IOException {
+        if (bs.readBoolean()) {
+
+            byte dataType = dis.readByte();
+            DataStreamMarshaller dsm = dataMarshallers[dataType & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + dataType);
+            }
+            DataStructure data = dsm.createObject();
+
+            if (data.isMarshallAware() && bs.readBoolean()) {
+
+                dis.readInt();
+                dis.readByte();
+
+                BooleanStream bs2 = new BooleanStream();
+                bs2.unmarshal(dis);
+                dsm.tightUnmarshal(this, data, dis, bs2);
+            } else {
+                dsm.tightUnmarshal(this, data, dis, bs);
+            }
+
+            return data;
+        } else {
+            return null;
+        }
+    }
+
+    public DataStructure looseUnmarshalNestedObject(DataInput dis) throws IOException {
+        if (dis.readBoolean()) {
+
+            byte dataType = dis.readByte();
+            DataStreamMarshaller dsm = dataMarshallers[dataType & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + dataType);
+            }
+            DataStructure data = dsm.createObject();
+            dsm.looseUnmarshal(this, data, dis);
+            return data;
+
+        } else {
+            return null;
+        }
+    }
+
+    public void looseMarshalNestedObject(DataStructure o, DataOutput dataOut) throws IOException {
+        dataOut.writeBoolean(o != null);
+        if (o != null) {
+            byte type = o.getDataStructureType();
+            dataOut.writeByte(type);
+            DataStreamMarshaller dsm = dataMarshallers[type & 0xFF];
+            if (dsm == null) {
+                throw new IOException("Unknown data type: " + type);
+            }
+            dsm.looseMarshal(this, o, dataOut);
+        }
+    }
+
+    public void runMarshallCacheEvictionSweep() {
+        // Do we need to start evicting??
+        while (marshallCacheMap.size() > marshallCache.length - MARSHAL_CACHE_FREE_SPACE) {
+            marshallCacheMap.remove(marshallCache[nextMarshallCacheEvictionIndex]);
+            marshallCache[nextMarshallCacheEvictionIndex] = null;
+
+            nextMarshallCacheEvictionIndex++;
+            if (nextMarshallCacheEvictionIndex >= marshallCache.length) {
+                nextMarshallCacheEvictionIndex = 0;
+            }
+        }
+    }
+
+    public Short getMarshallCacheIndex(DataStructure o) {
+        return marshallCacheMap.get(o);
+    }
+
+    public Short addToMarshallCache(DataStructure o) {
+        short i = nextMarshallCacheIndex++;
+        if (nextMarshallCacheIndex >= marshallCache.length) {
+            nextMarshallCacheIndex = 0;
+        }
+
+        // We can only cache that item if there is space left.
+        if (marshallCacheMap.size() < marshallCache.length) {
+            marshallCache[i] = o;
+            Short index = new Short(i);
+            marshallCacheMap.put(o, index);
+            return index;
+        } else {
+            // Use -1 to indicate that the value was not cached due to cache being full.
+            return new Short((short) -1);
+        }
+    }
+
+    public void setInUnmarshallCache(short index, DataStructure o) {
+        // There was no space left in the cache, so we can't put this in the cache.
+        if (index == -1) {
+            return;
+        }
+
+        unmarshallCache[index] = o;
+    }
+
+    public DataStructure getFromUnmarshallCache(short index) {
+        return unmarshallCache[index];
+    }
+
+    public void setStackTraceEnabled(boolean b) {
+        stackTraceEnabled = b;
+    }
+
+    public boolean isStackTraceEnabled() {
+        return stackTraceEnabled;
+    }
+
+    public boolean isTcpNoDelayEnabled() {
+        return tcpNoDelayEnabled;
+    }
+
+    public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) {
+        this.tcpNoDelayEnabled = tcpNoDelayEnabled;
+    }
+
+    public boolean isCacheEnabled() {
+        return cacheEnabled;
+    }
+
+    public void setCacheEnabled(boolean cacheEnabled) {
+        if (cacheEnabled) {
+            marshallCache = new DataStructure[MARSHAL_CACHE_SIZE];
+            unmarshallCache = new DataStructure[MARSHAL_CACHE_SIZE];
+        }
+        this.cacheEnabled = cacheEnabled;
+    }
+
+    public boolean isTightEncodingEnabled() {
+        return tightEncodingEnabled;
+    }
+
+    public void setTightEncodingEnabled(boolean tightEncodingEnabled) {
+        this.tightEncodingEnabled = tightEncodingEnabled;
+    }
+
+    public boolean isSizePrefixDisabled() {
+        return sizePrefixDisabled;
+    }
+
+    public void setSizePrefixDisabled(boolean prefixPacketSize) {
+        this.sizePrefixDisabled = prefixPacketSize;
+    }
+
+    public void setPreferedWireFormatInfo(WireFormatInfo info) {
+        this.preferedWireFormatInfo = info;
+    }
+
+    public WireFormatInfo getPreferedWireFormatInfo() {
+        return preferedWireFormatInfo;
+    }
+
+    public long getMaxFrameSize() {
+        return maxFrameSize;
+    }
+
+    public void setMaxFrameSize(long maxFrameSize) {
+        this.maxFrameSize = maxFrameSize;
+    }
+
+    public void renegotiateWireFormat(WireFormatInfo info) throws IOException {
+        if (preferedWireFormatInfo == null) {
+            throw new IllegalStateException("Wireformat cannot not be renegotiated.");
+        }
+
+        this.setVersion(min(preferedWireFormatInfo.getVersion(), info.getVersion()));
+        info.setVersion(this.getVersion());
+
+        this.setMaxFrameSize(min(preferedWireFormatInfo.getMaxFrameSize(), info.getMaxFrameSize()));
+        info.setMaxFrameSize(this.getMaxFrameSize());
+
+        this.stackTraceEnabled = info.isStackTraceEnabled() && preferedWireFormatInfo.isStackTraceEnabled();
+        info.setStackTraceEnabled(this.stackTraceEnabled);
+
+        this.tcpNoDelayEnabled = info.isTcpNoDelayEnabled() && preferedWireFormatInfo.isTcpNoDelayEnabled();
+        info.setTcpNoDelayEnabled(this.tcpNoDelayEnabled);
+
+        this.cacheEnabled = info.isCacheEnabled() && preferedWireFormatInfo.isCacheEnabled();
+        info.setCacheEnabled(this.cacheEnabled);
+
+        this.tightEncodingEnabled = info.isTightEncodingEnabled() && preferedWireFormatInfo.isTightEncodingEnabled();
+        info.setTightEncodingEnabled(this.tightEncodingEnabled);
+
+        this.sizePrefixDisabled = info.isSizePrefixDisabled() && preferedWireFormatInfo.isSizePrefixDisabled();
+        info.setSizePrefixDisabled(this.sizePrefixDisabled);
+
+        if (cacheEnabled) {
+            int size = Math.min(preferedWireFormatInfo.getCacheSize(), info.getCacheSize());
+            info.setCacheSize(size);
+
+            if (size == 0) {
+                size = MARSHAL_CACHE_SIZE;
+            }
+
+            marshallCache = new DataStructure[size];
+            unmarshallCache = new DataStructure[size];
+            nextMarshallCacheIndex = 0;
+            nextMarshallCacheEvictionIndex = 0;
+            marshallCacheMap = new HashMap<DataStructure, Short>();
+        } else {
+            marshallCache = null;
+            unmarshallCache = null;
+            nextMarshallCacheIndex = 0;
+            nextMarshallCacheEvictionIndex = 0;
+            marshallCacheMap = null;
+        }
+    }
+
+    protected int min(int version1, int version2) {
+        if (version1 < version2 && version1 > 0 || version2 <= 0) {
+            return version1;
+        }
+        return version2;
+    }
+
+    protected long min(long version1, long version2) {
+        if (version1 < version2 && version1 > 0 || version2 <= 0) {
+            return version1;
+        }
+        return version2;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormatFactory.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormatFactory.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormatFactory.java
new file mode 100644
index 0000000..333ec26
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormatFactory.java
@@ -0,0 +1,159 @@
+/**
+ * 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;
+
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+/**
+ * Creates a new instance of the OpenWireFormat codec.
+ */
+public class OpenWireFormatFactory {
+
+    //
+    // The default values here are what the wire format changes to after a
+    // default negotiation.
+    //
+
+    private int version = OpenWireFormat.DEFAULT_WIRE_VERSION;
+    private boolean stackTraceEnabled = true;
+    private boolean tcpNoDelayEnabled = true;
+    private boolean cacheEnabled = true;
+    private boolean tightEncodingEnabled = true;
+    private boolean sizePrefixDisabled;
+    private long maxInactivityDuration = 30 * 1000;
+    private long maxInactivityDurationInitalDelay = 10 * 1000;
+    private int cacheSize = 1024;
+    private long maxFrameSize = OpenWireFormat.DEFAULT_MAX_FRAME_SIZE;
+    private String host = null;
+
+    public OpenWireFormat createWireFormat() {
+        WireFormatInfo info = new WireFormatInfo();
+        info.setVersion(version);
+
+        try {
+            info.setStackTraceEnabled(stackTraceEnabled);
+            info.setCacheEnabled(cacheEnabled);
+            info.setTcpNoDelayEnabled(tcpNoDelayEnabled);
+            info.setTightEncodingEnabled(tightEncodingEnabled);
+            info.setSizePrefixDisabled(sizePrefixDisabled);
+            info.setMaxInactivityDuration(maxInactivityDuration);
+            info.setMaxInactivityDurationInitalDelay(maxInactivityDurationInitalDelay);
+            info.setCacheSize(cacheSize);
+            info.setMaxFrameSize(maxFrameSize);
+            if (host != null) {
+                info.setHost(host);
+            }
+        } catch (Exception e) {
+            IllegalStateException ise = new IllegalStateException("Could not configure WireFormatInfo");
+            ise.initCause(e);
+            throw ise;
+        }
+
+        OpenWireFormat f = new OpenWireFormat(version);
+        f.setMaxFrameSize(maxFrameSize);
+        f.setPreferedWireFormatInfo(info);
+        return f;
+    }
+
+    public boolean isStackTraceEnabled() {
+        return stackTraceEnabled;
+    }
+
+    public void setStackTraceEnabled(boolean stackTraceEnabled) {
+        this.stackTraceEnabled = stackTraceEnabled;
+    }
+
+    public boolean isTcpNoDelayEnabled() {
+        return tcpNoDelayEnabled;
+    }
+
+    public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) {
+        this.tcpNoDelayEnabled = tcpNoDelayEnabled;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public boolean isCacheEnabled() {
+        return cacheEnabled;
+    }
+
+    public void setCacheEnabled(boolean cacheEnabled) {
+        this.cacheEnabled = cacheEnabled;
+    }
+
+    public boolean isTightEncodingEnabled() {
+        return tightEncodingEnabled;
+    }
+
+    public void setTightEncodingEnabled(boolean tightEncodingEnabled) {
+        this.tightEncodingEnabled = tightEncodingEnabled;
+    }
+
+    public boolean isSizePrefixDisabled() {
+        return sizePrefixDisabled;
+    }
+
+    public void setSizePrefixDisabled(boolean sizePrefixDisabled) {
+        this.sizePrefixDisabled = sizePrefixDisabled;
+    }
+
+    public long getMaxInactivityDuration() {
+        return maxInactivityDuration;
+    }
+
+    public void setMaxInactivityDuration(long maxInactivityDuration) {
+        this.maxInactivityDuration = maxInactivityDuration;
+    }
+
+    public int getCacheSize() {
+        return cacheSize;
+    }
+
+    public void setCacheSize(int cacheSize) {
+        this.cacheSize = cacheSize;
+    }
+
+    public long getMaxInactivityDurationInitalDelay() {
+        return maxInactivityDurationInitalDelay;
+    }
+
+    public void setMaxInactivityDurationInitalDelay(long maxInactivityDurationInitalDelay) {
+        this.maxInactivityDurationInitalDelay = maxInactivityDurationInitalDelay;
+    }
+
+    public long getMaxFrameSize() {
+        return maxFrameSize;
+    }
+
+    public void setMaxFrameSize(long maxFrameSize) {
+        this.maxFrameSize = maxFrameSize;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BaseCommandMarshaller.java
new file mode 100644
index 0000000..ea3a3f3
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerIdMarshaller.java
new file mode 100644
index 0000000..43e4154
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..e89e8f7
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..330f450
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..73b3c8c
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..0dab2a9
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..80258c7
--- /dev/null
+++ b/openwire-core/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/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..4579843
--- /dev/null
+++ b/openwire-core/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());
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..c645492
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerIdMarshaller.java
@@ -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.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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ConsumerIdMarshaller extends BaseDataStreamMarshaller {
+
+    /**
+     * Return the type of Data Structure we marshal
+     *
+     * @return short representation of the type data structure
+     */
+    @Override
+    public byte getDataStructureType() {
+        return ConsumerId.DATA_STRUCTURE_TYPE;
+    }
+
+    /**
+     * @return a new object instance
+     */
+    @Override
+    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
+     */
+    @Override
+    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
+     */
+    @Override
+    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
+     */
+    @Override
+    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
+     */
+    @Override
+    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
+     */
+    @Override
+    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);
+    }
+}


Mime
View raw message