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 2014/07/24 16:22:50 UTC
[01/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Repository: activemq-openwire
Updated Branches:
refs/heads/master 455e192c2 -> 7ae454fae
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..f61a0cb
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v8;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
[21/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..b682348
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..880d211
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageIdMarshaller.java
new file mode 100644
index 0000000..14cd568
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageMarshaller.java
new file mode 100644
index 0000000..e09753e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageMarshaller.java
@@ -0,0 +1,304 @@
+/**
+ * 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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessagePullMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessagePullMarshaller.java
new file mode 100644
index 0000000..3734139
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..29b697a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v3;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBlobMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..db57c10
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..04ef00a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..09375a0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireDestinationMarshaller.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.v3;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..4f12ade
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..00d9010
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..28c3673
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..c2f6404
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireStreamMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..0f4ee7b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..803802d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v3;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[12/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..31c6577
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..1a90214
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTextMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..e70b689
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..04f9b63
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/PartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/PartialCommandMarshaller.java
new file mode 100644
index 0000000..a7bfa12
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerAckMarshaller.java
new file mode 100644
index 0000000..77bc01e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerIdMarshaller.java
new file mode 100644
index 0000000..8bbdc9d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerIdMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..ffdaa52
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..66c338d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveInfoMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ looseMarshalLong(wireFormat, info.getLastDeliveredSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveSubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..cc7d3f0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v5;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ReplayCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..e1bc425
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ResponseMarshaller.java
new file mode 100644
index 0000000..7c6edcb
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ResponseMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionIdMarshaller.java
new file mode 100644
index 0000000..1362739
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionIdMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionInfoMarshaller.java
new file mode 100644
index 0000000..9aec89f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SessionInfoMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ShutdownInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..d166196
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..69dadb9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionIdMarshaller.java
new file mode 100644
index 0000000..640d6ec
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v5;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[45/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataResponseMarshaller.java
new file mode 100644
index 0000000..f010577
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v10;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DestinationInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..978509a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v10;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DiscoveryEventMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..4796429
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DiscoveryEventMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ExceptionResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..d88daf0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/FlushCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/FlushCommandMarshaller.java
new file mode 100644
index 0000000..cfb6393
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/IntegerResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..35d5378
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalQueueAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..5017e62
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTopicAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..d5dd037
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTraceMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTraceMarshaller.java
new file mode 100644
index 0000000..1100320
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTraceMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTransactionMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..36d2d7d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTransactionMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/KeepAliveInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..2c2f2e2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LastPartialCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..e4e4410
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LocalTransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..baefe7b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/LocalTransactionIdMarshaller.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.v10;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(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/v10/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MarshallerFactory.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MarshallerFactory.java
new file mode 100644
index 0000000..3235255
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v10;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageAckMarshaller.java
new file mode 100644
index 0000000..2a8e030
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageAckMarshaller.java
@@ -0,0 +1,160 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(tightUnmarsalThrowable(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 {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getPoisonCause(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ tightMarshalThrowable2(wireFormat, info.getPoisonCause(), 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ looseMarshalThrowable(wireFormat, info.getPoisonCause(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..9a9e9f7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
[06/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..c35f1e1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataArrayResponseMarshaller.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.v7;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataResponseMarshaller.java
new file mode 100644
index 0000000..3fda48a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v7;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..e268ad3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v7;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..994ca99
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/DiscoveryEventMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..3562927
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/FlushCommandMarshaller.java
new file mode 100644
index 0000000..1647013
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..e6948f2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..8c238a6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..ff6896d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTraceMarshaller.java
new file mode 100644
index 0000000..f9bedde
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTraceMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..63ef41b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/JournalTransactionMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..29b051e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..653b7d6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..542b1e5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/LocalTransactionIdMarshaller.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.v7;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MarshallerFactory.java
new file mode 100644
index 0000000..b605886
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v7;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageAckMarshaller.java
new file mode 100644
index 0000000..97003a9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageAckMarshaller.java
@@ -0,0 +1,160 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(tightUnmarsalThrowable(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 {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getPoisonCause(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ tightMarshalThrowable2(wireFormat, info.getPoisonCause(), 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ looseMarshalThrowable(wireFormat, info.getPoisonCause(), dataOut);
+ }
+}
[08/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..cdc1407
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..14cea6a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTextMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..a9048fe
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..a3f46cf
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/PartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/PartialCommandMarshaller.java
new file mode 100644
index 0000000..0dcd309
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerAckMarshaller.java
new file mode 100644
index 0000000..875a5a2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerIdMarshaller.java
new file mode 100644
index 0000000..362d477
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerIdMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..05f395f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..a54cb7c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveInfoMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ looseMarshalLong(wireFormat, info.getLastDeliveredSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveSubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..650db52
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v6;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ReplayCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..1595e54
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ResponseMarshaller.java
new file mode 100644
index 0000000..80fb573
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ResponseMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionIdMarshaller.java
new file mode 100644
index 0000000..0eda43f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionIdMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionInfoMarshaller.java
new file mode 100644
index 0000000..b6830f9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SessionInfoMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ShutdownInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..b27a7dd
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..2496757
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionIdMarshaller.java
new file mode 100644
index 0000000..b6359fd
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v6;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[15/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..251ba71
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionInfoMarshaller.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.v4;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..45c5b74
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..f5d49e2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BaseCommandMarshaller.java
new file mode 100644
index 0000000..f506c74
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/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.v5;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerIdMarshaller.java
new file mode 100644
index 0000000..ac3aa09
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerIdMarshaller.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.v5;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..33c5637
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v5;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..3685d1b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionControlMarshaller.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.v5;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..70e7dbf
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/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.v5;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..473e5f0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/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.v5;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..a75ed10
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConnectionInfoMarshaller.java
@@ -0,0 +1,174 @@
+/**
+ * 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.v5;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(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());
+ bs.writeBoolean(info.isClientMaster());
+
+ 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();
+ 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((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(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());
+ dataOut.writeBoolean(info.isClientMaster());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..9cc4eaa
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..36b1f74
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/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.v5;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..20f5629
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ConsumerInfoMarshaller.java
@@ -0,0 +1,248 @@
+/**
+ * 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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ControlCommandMarshaller.java
new file mode 100644
index 0000000..7eb902d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v5;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
[48/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..0331e6b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((org.apache.activemq.openwire.commands.ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((org.apache.activemq.openwire.commands.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(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/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MarshallerFactory.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MarshallerFactory.java
new file mode 100644
index 0000000..e170e80
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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 org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public final class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshalers
+ */
+ private static final DataStreamMarshaller MARSHALLER[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new LocalTransactionIdMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new MessageAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new MessageIdMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new SessionIdMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new ResponseMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new DataResponseMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new ExceptionResponseMarshaller());
+ }
+
+ private MarshallerFactory() {
+ }
+
+ private static void add(DataStreamMarshaller dsm) {
+ MARSHALLER[dsm.getDataStructureType()] = dsm;
+ }
+
+ public static DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return MARSHALLER;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java
new file mode 100644
index 0000000..8a44894
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((org.apache.activemq.openwire.commands.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((org.apache.activemq.openwire.commands.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((org.apache.activemq.openwire.commands.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((org.apache.activemq.openwire.commands.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..e283152
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java
@@ -0,0 +1,139 @@
+/**
+ * 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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((org.apache.activemq.openwire.commands.Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((org.apache.activemq.openwire.commands.Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..ec9939e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((org.apache.activemq.openwire.commands.MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((org.apache.activemq.openwire.commands.MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.java
new file mode 100644
index 0000000..3b0448d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((org.apache.activemq.openwire.commands.ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((org.apache.activemq.openwire.commands.ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java
new file mode 100644
index 0000000..4382431
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java
@@ -0,0 +1,258 @@
+/**
+ * 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.Message;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((org.apache.activemq.openwire.commands.ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((org.apache.activemq.openwire.commands.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((org.apache.activemq.openwire.commands.TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((org.apache.activemq.openwire.commands.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ 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.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((org.apache.activemq.openwire.commands.ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((org.apache.activemq.openwire.commands.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((org.apache.activemq.openwire.commands.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ 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.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..a917b72
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.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.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;
+import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
+
+public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new NetworkBridgeFilter();
+ }
+
+ /**
+ * 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);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+ info.setNetworkTTL(dataIn.readInt());
+ info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), 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);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+ dataOut.writeInt(info.getNetworkTTL());
+ tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+ info.setNetworkTTL(dataIn.readInt());
+ info.setNetworkBrokerId((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getNetworkTTL());
+ looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..147432b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..5e76809
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..2d7802a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..362e5af
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..599755a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..32cd878
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireStreamMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..bf9a169
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[22/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..0402994
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataArrayResponseMarshaller.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.v3;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataResponseMarshaller.java
new file mode 100644
index 0000000..b603cca
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v3;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..928ee2b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v3;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..cd2810b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/DiscoveryEventMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..a31d7fa
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/FlushCommandMarshaller.java
new file mode 100644
index 0000000..c3df0e3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..e394f93
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..beb4baa
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..55c300b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTraceMarshaller.java
new file mode 100644
index 0000000..3ab81d6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTraceMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..cba4afa
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/JournalTransactionMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..b2d468b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..0e419c2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..3df82c8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/LocalTransactionIdMarshaller.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.v3;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MarshallerFactory.java
new file mode 100644
index 0000000..31b9737
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v3;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageAckMarshaller.java
new file mode 100644
index 0000000..ca8b0f3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/MessageAckMarshaller.java
@@ -0,0 +1,155 @@
+/**
+ * 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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ }
+}
[11/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..45b5ca9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/TransactionInfoMarshaller.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.v5;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..bf9d46e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..212c43b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BaseCommandMarshaller.java
new file mode 100644
index 0000000..24b9cf2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/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.v6;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerIdMarshaller.java
new file mode 100644
index 0000000..6ad3e2f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerIdMarshaller.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.v6;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..f951bfa
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v6;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..2cc1ca7
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionControlMarshaller.java
@@ -0,0 +1,158 @@
+/**
+ * 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.v6;
+
+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());
+ info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
+ info.setReconnectTo(tightUnmarshalString(dataIn, bs));
+ info.setRebalanceConnection(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());
+ rc += tightMarshalString1(info.getConnectedBrokers(), bs);
+ rc += tightMarshalString1(info.getReconnectTo(), bs);
+ bs.writeBoolean(info.isRebalanceConnection());
+
+ 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getConnectedBrokers(), dataOut, bs);
+ tightMarshalString2(info.getReconnectTo(), dataOut, bs);
+ 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());
+ info.setConnectedBrokers(looseUnmarshalString(dataIn));
+ info.setReconnectTo(looseUnmarshalString(dataIn));
+ info.setRebalanceConnection(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());
+ looseMarshalString(info.getConnectedBrokers(), dataOut);
+ looseMarshalString(info.getReconnectTo(), dataOut);
+ dataOut.writeBoolean(info.isRebalanceConnection());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..46f6997
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/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.v6;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..6088353
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/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.v6;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..4154ca2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConnectionInfoMarshaller.java
@@ -0,0 +1,190 @@
+/**
+ * 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.v6;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(bs.readBoolean());
+ info.setFaultTolerant(bs.readBoolean());
+ info.setFailoverReconnect(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());
+ bs.writeBoolean(info.isClientMaster());
+ bs.writeBoolean(info.isFaultTolerant());
+ bs.writeBoolean(info.isFailoverReconnect());
+
+ 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();
+ 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);
+
+ ConnectionInfo info = (ConnectionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setFailoverReconnect(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());
+ dataOut.writeBoolean(info.isClientMaster());
+ dataOut.writeBoolean(info.isFaultTolerant());
+ dataOut.writeBoolean(info.isFailoverReconnect());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..d4553e9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerControlMarshaller.java
@@ -0,0 +1,154 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+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.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setClose(bs.readBoolean());
+ info.setConsumerId((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isClose());
+ rc += tightMarshalNestedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalNestedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetch());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeBoolean(info.isClose());
+ looseMarshalNestedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeInt(info.getPrefetch());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..9c612f9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/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.v6;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..4f2fe3f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ConsumerInfoMarshaller.java
@@ -0,0 +1,248 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ControlCommandMarshaller.java
new file mode 100644
index 0000000..8f26f1f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v6;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
[14/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..b93a28b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataArrayResponseMarshaller.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.v5;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataResponseMarshaller.java
new file mode 100644
index 0000000..b659dfc
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v5;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..02cb623
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v5;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..2d8b968
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/DiscoveryEventMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..f69776b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/FlushCommandMarshaller.java
new file mode 100644
index 0000000..fba4bb5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..75cd6a4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..30a32e0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..7e1f511
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTraceMarshaller.java
new file mode 100644
index 0000000..4f4ce3d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTraceMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..86169f4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/JournalTransactionMarshaller.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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..8fc6ce6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..31bb61a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..30958d6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/LocalTransactionIdMarshaller.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.v5;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MarshallerFactory.java
new file mode 100644
index 0000000..38ff750
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v5;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageAckMarshaller.java
new file mode 100644
index 0000000..2362374
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageAckMarshaller.java
@@ -0,0 +1,155 @@
+/**
+ * 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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ }
+}
[39/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTopicMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..b97e003
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/PartialCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/PartialCommandMarshaller.java
new file mode 100644
index 0000000..2f98bec
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerAckMarshaller.java
new file mode 100644
index 0000000..34b3a26
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerIdMarshaller.java
new file mode 100644
index 0000000..471b254
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerIdMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..6d3565b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..1bb06e7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveInfoMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ looseMarshalLong(wireFormat, info.getLastDeliveredSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveSubscriptionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..06d23b8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v9;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ReplayCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..aa2c3c2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ResponseMarshaller.java
new file mode 100644
index 0000000..395ab78
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ResponseMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionIdMarshaller.java
new file mode 100644
index 0000000..b3d96c0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionIdMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, 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/v9/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionInfoMarshaller.java
new file mode 100644
index 0000000..bcf49b5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SessionInfoMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ShutdownInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..eb0cd49
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SubscriptionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..5422732
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionIdMarshaller.java
new file mode 100644
index 0000000..7f4d466
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v9;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..901eac7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.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.v9;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..ed1db10
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..2a64979
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
[13/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..5c38d1d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..c169b98
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageIdMarshaller.java
new file mode 100644
index 0000000..1c1d20d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageMarshaller.java
new file mode 100644
index 0000000..cac68fe
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessageMarshaller.java
@@ -0,0 +1,304 @@
+/**
+ * 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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessagePullMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessagePullMarshaller.java
new file mode 100644
index 0000000..9b09053
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v5;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..21e9d08
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v5;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBlobMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..89a5df2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..8d59c71
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..5e759e8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireDestinationMarshaller.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.v5;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..246e96d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..5b94c6d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..b382c25
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..079300b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireStreamMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..963a23e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v5;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..e42a162
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v5/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v5;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[42/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/XATransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..4df6cba
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BaseCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BaseCommandMarshaller.java
new file mode 100644
index 0000000..4490f90
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/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.v9;
+
+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/v9/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BrokerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BrokerIdMarshaller.java
new file mode 100644
index 0000000..da5325c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BrokerIdMarshaller.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.v9;
+
+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/v9/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BrokerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..39c65fe
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v9;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionControlMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..e1c201d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionControlMarshaller.java
@@ -0,0 +1,163 @@
+/**
+ * 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.v9;
+
+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());
+ info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
+ info.setReconnectTo(tightUnmarshalString(dataIn, bs));
+ info.setRebalanceConnection(bs.readBoolean());
+ info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * 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());
+ rc += tightMarshalString1(info.getConnectedBrokers(), bs);
+ rc += tightMarshalString1(info.getReconnectTo(), bs);
+ bs.writeBoolean(info.isRebalanceConnection());
+ rc += tightMarshalByteArray1(info.getToken(), 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getConnectedBrokers(), dataOut, bs);
+ tightMarshalString2(info.getReconnectTo(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalByteArray2(info.getToken(), 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setExit(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setResume(dataIn.readBoolean());
+ info.setSuspend(dataIn.readBoolean());
+ info.setConnectedBrokers(looseUnmarshalString(dataIn));
+ info.setReconnectTo(looseUnmarshalString(dataIn));
+ info.setRebalanceConnection(dataIn.readBoolean());
+ info.setToken(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * 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());
+ looseMarshalString(info.getConnectedBrokers(), dataOut);
+ looseMarshalString(info.getReconnectTo(), dataOut);
+ dataOut.writeBoolean(info.isRebalanceConnection());
+ looseMarshalByteArray(wireFormat, info.getToken(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionErrorMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..1481104
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/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.v9;
+
+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/v9/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..ccaa125
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/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.v9;
+
+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/v9/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..f108fb5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConnectionInfoMarshaller.java
@@ -0,0 +1,195 @@
+/**
+ * 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.v9;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(bs.readBoolean());
+ info.setFaultTolerant(bs.readBoolean());
+ info.setFailoverReconnect(bs.readBoolean());
+ info.setClientIp(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 {
+ 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());
+ bs.writeBoolean(info.isClientMaster());
+ bs.writeBoolean(info.isFaultTolerant());
+ bs.writeBoolean(info.isFailoverReconnect());
+ rc += tightMarshalString1(info.getClientIp(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getClientIp(), 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);
+
+ ConnectionInfo info = (ConnectionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setFailoverReconnect(dataIn.readBoolean());
+ info.setClientIp(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isClientMaster());
+ dataOut.writeBoolean(info.isFaultTolerant());
+ dataOut.writeBoolean(info.isFailoverReconnect());
+ looseMarshalString(info.getClientIp(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerControlMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..9b0b783
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerControlMarshaller.java
@@ -0,0 +1,154 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+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.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setClose(bs.readBoolean());
+ info.setConsumerId((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isClose());
+ rc += tightMarshalNestedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalNestedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetch());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeBoolean(info.isClose());
+ looseMarshalNestedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeInt(info.getPrefetch());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..1d8c55a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/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.v9;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..c534048
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ConsumerInfoMarshaller.java
@@ -0,0 +1,248 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ControlCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ControlCommandMarshaller.java
new file mode 100644
index 0000000..a06ca69
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v9;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataArrayResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..04cae5a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataArrayResponseMarshaller.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.v9;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataResponseMarshaller.java
new file mode 100644
index 0000000..bb7ba02
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v9;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
[07/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..d90ceaf
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/TransactionInfoMarshaller.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.v6;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..48b8084
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..9075cd0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BaseCommandMarshaller.java
new file mode 100644
index 0000000..717ebed
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/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.v7;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerIdMarshaller.java
new file mode 100644
index 0000000..6417be0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerIdMarshaller.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.v7;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..9aa96e3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v7;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..c8bee49
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionControlMarshaller.java
@@ -0,0 +1,158 @@
+/**
+ * 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.v7;
+
+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());
+ info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
+ info.setReconnectTo(tightUnmarshalString(dataIn, bs));
+ info.setRebalanceConnection(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());
+ rc += tightMarshalString1(info.getConnectedBrokers(), bs);
+ rc += tightMarshalString1(info.getReconnectTo(), bs);
+ bs.writeBoolean(info.isRebalanceConnection());
+
+ 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getConnectedBrokers(), dataOut, bs);
+ tightMarshalString2(info.getReconnectTo(), dataOut, bs);
+ 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());
+ info.setConnectedBrokers(looseUnmarshalString(dataIn));
+ info.setReconnectTo(looseUnmarshalString(dataIn));
+ info.setRebalanceConnection(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());
+ looseMarshalString(info.getConnectedBrokers(), dataOut);
+ looseMarshalString(info.getReconnectTo(), dataOut);
+ dataOut.writeBoolean(info.isRebalanceConnection());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..d93ae4e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/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.v7;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..eddae77
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/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.v7;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..5d68e2e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConnectionInfoMarshaller.java
@@ -0,0 +1,190 @@
+/**
+ * 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.v7;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(bs.readBoolean());
+ info.setFaultTolerant(bs.readBoolean());
+ info.setFailoverReconnect(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());
+ bs.writeBoolean(info.isClientMaster());
+ bs.writeBoolean(info.isFaultTolerant());
+ bs.writeBoolean(info.isFailoverReconnect());
+
+ 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();
+ 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);
+
+ ConnectionInfo info = (ConnectionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setFailoverReconnect(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());
+ dataOut.writeBoolean(info.isClientMaster());
+ dataOut.writeBoolean(info.isFaultTolerant());
+ dataOut.writeBoolean(info.isFailoverReconnect());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..a1a158c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerControlMarshaller.java
@@ -0,0 +1,154 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+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.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setClose(bs.readBoolean());
+ info.setConsumerId((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isClose());
+ rc += tightMarshalNestedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalNestedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetch());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeBoolean(info.isClose());
+ looseMarshalNestedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeInt(info.getPrefetch());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..69055a2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/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.v7;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..c8974de
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ConsumerInfoMarshaller.java
@@ -0,0 +1,248 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ControlCommandMarshaller.java
new file mode 100644
index 0000000..640a7d5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v7;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
[36/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBytesMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBytesMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBytesMessage.java
new file mode 100644
index 0000000..e7ea14c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBytesMessage.java
@@ -0,0 +1,197 @@
+/**
+ * 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.commands;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.zip.Deflater;
+import java.util.zip.Inflater;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotReadableException;
+
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.BufferEditor;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+
+/**
+ * Provides an abstraction layer around the standard OpenWireMessage object for
+ * implementation of a JMS style BytesMessage instance. This class provides access
+ * to the message body content via mechanism that make it easy to wrap this object
+ * and adhere to the JMS BytesMessage interface.
+ *
+ * openwire:marshaller code=24
+ */
+public class OpenWireBytesMessage extends OpenWireMessage {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_BYTES_MESSAGE;
+
+ @Override
+ public OpenWireBytesMessage copy() {
+ OpenWireBytesMessage copy = new OpenWireBytesMessage();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(OpenWireBytesMessage copy) {
+ super.copy(copy);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "jms/bytes-message";
+ }
+
+ /**
+ * Gets the number of bytes of the message body when the message is in
+ * read-only mode. The value returned can be used to allocate a byte array.
+ * The value returned is the entire length of the message body, regardless
+ * of where the pointer for reading the message is currently located.
+ *
+ * @return number of bytes in the message
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ * @since 1.1
+ */
+ public long getBodyLength() throws JMSException {
+ if (compressed) {
+ return getBodyBytes().length;
+ } else if (content != null) {
+ return content.length();
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * Provides a fast way to read the message contents.
+ *
+ * This method, unlike the base class getContent method will perform any
+ * needed decompression on a message that was received with a compressed
+ * payload. The complete message body will then be read and returned in
+ * a byte array copy. Changes to the returned byte array are not reflected
+ * in the underlying message contents.
+ *
+ * @return a copy of the message contents, uncompressed as needed.
+ *
+ * @throws JMSException if an error occurs while accessing the message payload.
+ */
+ public byte[] getBodyBytes() throws JMSException {
+ Buffer data = getPayload();
+ if (data == null) {
+ data = new Buffer(new byte[] {}, 0, 0);
+ }
+
+ return data.toByteArray();
+ }
+
+ /**
+ * Set the contents of this message.
+ *
+ * This method will, unlike the base class setContent method perform any
+ * necessary compression of the given bytes if the message is configured for
+ * message compression.
+ *
+ * @param bytes
+ * the new byte array to use to fill the message body.
+ */
+ public void setBodyBytes(byte[] bytes) {
+ setBodyBytes(new Buffer(bytes));
+ }
+
+ /**
+ * Set the contents of this message.
+ *
+ * This method will, unlike the base class setContent method perform any
+ * necessary compression of the given bytes if the message is configured for
+ * message compression.
+ *
+ * @param buffer
+ * the new byte Buffer to use to fill the message body.
+ */
+ public void setBodyBytes(Buffer buffer) {
+ try {
+ setPayload(buffer);
+ } catch (Exception ioe) {
+ throw new RuntimeException(ioe.getMessage(), ioe);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "OpenWireBytesMessage";
+ }
+
+ @Override
+ protected Buffer doDecompress() throws IOException {
+ Buffer compressed = getContent();
+ Inflater inflater = new Inflater();
+ ByteArrayOutputStream decompressed = new ByteArrayOutputStream();
+ try {
+ BufferEditor editor = BufferEditor.big(compressed);
+ int length = editor.readInt();
+ compressed.offset = 0;
+ byte[] data = Arrays.copyOfRange(compressed.getData(), 4, compressed.getLength());
+ inflater.setInput(data);
+ byte[] buffer = new byte[length];
+ int count = inflater.inflate(buffer);
+ decompressed.write(buffer, 0, count);
+ return decompressed.toBuffer();
+ } catch (Exception e) {
+ throw new IOException(e);
+ } finally {
+ inflater.end();
+ decompressed.close();
+ }
+ }
+
+ @Override
+ protected void doCompress() throws IOException {
+ compressed = true;
+ Buffer bytes = getContent();
+ if (bytes != null) {
+ int length = bytes.getLength();
+ ByteArrayOutputStream compressed = new ByteArrayOutputStream();
+ compressed.write(new byte[4]);
+ Deflater deflater = new Deflater();
+ try {
+ deflater.setInput(bytes.data);
+ deflater.finish();
+ byte[] buffer = new byte[1024];
+ while (!deflater.finished()) {
+ int count = deflater.deflate(buffer);
+ compressed.write(buffer, 0, count);
+ }
+
+ bytes = compressed.toBuffer();
+ bytes.bigEndianEditor().writeInt(length);
+ bytes.offset = 0;
+ bytes.length += 4;
+ setContent(bytes);
+ } finally {
+ deflater.end();
+ compressed.close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireDestination.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireDestination.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireDestination.java
new file mode 100644
index 0000000..1b3d57f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireDestination.java
@@ -0,0 +1,396 @@
+/**
+ * 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.commands;
+
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.Topic;
+
+import org.apache.activemq.openwire.utils.DefaultUnresolvedDestinationTransformer;
+import org.apache.activemq.openwire.utils.UnresolvedDestinationTransformer;
+
+/**
+ * Base Destination class used to provide most of the utilities necessary to deal
+ * with incoming and outgoing destination processing.
+ *
+ * @openwire:marshaller
+ */
+public abstract class OpenWireDestination implements Destination, DataStructure, Comparable<OpenWireDestination> {
+
+ public static final String PATH_SEPERATOR = ".";
+ public static final char COMPOSITE_SEPERATOR = ',';
+
+ public static final byte QUEUE_TYPE = 0x01;
+ public static final byte TOPIC_TYPE = 0x02;
+ public static final byte TEMP_MASK = 0x04;
+ public static final byte TEMP_TOPIC_TYPE = TOPIC_TYPE | TEMP_MASK;
+ public static final byte TEMP_QUEUE_TYPE = QUEUE_TYPE | TEMP_MASK;
+
+ public static final String QUEUE_QUALIFIED_PREFIX = "queue://";
+ public static final String TOPIC_QUALIFIED_PREFIX = "topic://";
+ public static final String TEMP_QUEUE_QUALIFED_PREFIX = "temp-queue://";
+ public static final String TEMP_TOPIC_QUALIFED_PREFIX = "temp-topic://";
+
+ public static final String TEMP_DESTINATION_NAME_PREFIX = "ID:";
+
+ protected String physicalName;
+
+ protected transient OpenWireDestination[] compositeDestinations;
+ protected transient String[] destinationPaths;
+ protected transient boolean isPattern;
+ protected transient int hashValue;
+ protected Map<String, String> options;
+
+ protected static UnresolvedDestinationTransformer unresolvableDestinationTransformer = new DefaultUnresolvedDestinationTransformer();
+
+ public OpenWireDestination() {
+ }
+
+ protected OpenWireDestination(String name) {
+ setPhysicalName(name);
+ }
+
+ public OpenWireDestination(OpenWireDestination composites[]) {
+ setCompositeDestinations(composites);
+ }
+
+ // static helper methods for working with destinations
+ // -------------------------------------------------------------------------
+ public static OpenWireDestination createDestination(String name, byte defaultType) {
+ if (name.startsWith(QUEUE_QUALIFIED_PREFIX)) {
+ return new OpenWireQueue(name.substring(QUEUE_QUALIFIED_PREFIX.length()));
+ } else if (name.startsWith(TOPIC_QUALIFIED_PREFIX)) {
+ return new OpenWireTopic(name.substring(TOPIC_QUALIFIED_PREFIX.length()));
+ } else if (name.startsWith(TEMP_QUEUE_QUALIFED_PREFIX)) {
+ return new OpenWireTempQueue(name.substring(TEMP_QUEUE_QUALIFED_PREFIX.length()));
+ } else if (name.startsWith(TEMP_TOPIC_QUALIFED_PREFIX)) {
+ return new OpenWireTempTopic(name.substring(TEMP_TOPIC_QUALIFED_PREFIX.length()));
+ }
+
+ switch (defaultType) {
+ case QUEUE_TYPE:
+ return new OpenWireQueue(name);
+ case TOPIC_TYPE:
+ return new OpenWireTopic(name);
+ case TEMP_QUEUE_TYPE:
+ return new OpenWireTempQueue(name);
+ case TEMP_TOPIC_TYPE:
+ return new OpenWireTempTopic(name);
+ default:
+ throw new IllegalArgumentException("Invalid default destination type: " + defaultType);
+ }
+ }
+
+ public static OpenWireDestination transform(Destination dest) throws JMSException {
+ if (dest == null) {
+ return null;
+ }
+ if (dest instanceof OpenWireDestination) {
+ return (OpenWireDestination)dest;
+ }
+
+ if (dest instanceof Queue && dest instanceof Topic) {
+ String queueName = ((Queue) dest).getQueueName();
+ String topicName = ((Topic) dest).getTopicName();
+ if (queueName != null && topicName == null) {
+ return new OpenWireQueue(queueName);
+ } else if (queueName == null && topicName != null) {
+ return new OpenWireTopic(topicName);
+ } else {
+ return unresolvableDestinationTransformer.transform(dest);
+ }
+ }
+ if (dest instanceof TemporaryQueue) {
+ return new OpenWireTempQueue(((TemporaryQueue)dest).getQueueName());
+ }
+ if (dest instanceof TemporaryTopic) {
+ return new OpenWireTempTopic(((TemporaryTopic)dest).getTopicName());
+ }
+ if (dest instanceof Queue) {
+ return new OpenWireQueue(((Queue)dest).getQueueName());
+ }
+ if (dest instanceof Topic) {
+ return new OpenWireTopic(((Topic)dest).getTopicName());
+ }
+ throw new JMSException("Could not transform the destination into a ActiveMQ destination: " + dest);
+ }
+
+ public static int compare(OpenWireDestination destination, OpenWireDestination destination2) {
+ if (destination == destination2) {
+ return 0;
+ }
+ if (destination == null) {
+ return -1;
+ } else if (destination2 == null) {
+ return 1;
+ } else {
+ if (destination.isQueue() == destination2.isQueue()) {
+ return destination.getPhysicalName().compareTo(destination2.getPhysicalName());
+ } else {
+ return destination.isQueue() ? -1 : 1;
+ }
+ }
+ }
+
+ @Override
+ public int compareTo(OpenWireDestination that) {
+ if (that == null) {
+ return -1;
+ }
+ return compare(this, that);
+ }
+
+ public boolean isComposite() {
+ return compositeDestinations != null;
+ }
+
+ public OpenWireDestination[] getCompositeDestinations() {
+ return compositeDestinations;
+ }
+
+ public void setCompositeDestinations(OpenWireDestination[] destinations) {
+ this.compositeDestinations = destinations;
+ this.destinationPaths = null;
+ this.hashValue = 0;
+ this.isPattern = false;
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < destinations.length; i++) {
+ if (i != 0) {
+ sb.append(COMPOSITE_SEPERATOR);
+ }
+ if (getDestinationType() == destinations[i].getDestinationType()) {
+ sb.append(destinations[i].getPhysicalName());
+ } else {
+ sb.append(destinations[i].getQualifiedName());
+ }
+ }
+ physicalName = sb.toString();
+ }
+
+ public String getQualifiedName() {
+ if (isComposite()) {
+ return physicalName;
+ }
+ return getQualifiedPrefix() + physicalName;
+ }
+
+ protected abstract String getQualifiedPrefix();
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getPhysicalName() {
+ return physicalName;
+ }
+
+ public void setPhysicalName(String physicalName) {
+ physicalName = physicalName.trim();
+ final int length = physicalName.length();
+
+ if (physicalName.isEmpty()) {
+ throw new IllegalArgumentException("Invalid destination name: a non-empty name is required");
+ }
+
+ // options offset
+ int p = -1;
+ boolean composite = false;
+ for (int i = 0; i < length; i++) {
+ char c = physicalName.charAt(i);
+ if (c == '?') {
+ p = i;
+ break;
+ }
+ if (c == COMPOSITE_SEPERATOR) {
+ // won't be wild card
+ isPattern = false;
+ composite = true;
+ } else if (!composite && (c == '*' || c == '>')) {
+ isPattern = true;
+ }
+ }
+
+ // Strip off any options
+ if (p >= 0) {
+ String optstring = physicalName.substring(p + 1);
+ physicalName = physicalName.substring(0, p);
+ try {
+ options = parseQuery(optstring);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Invalid destination name: " + physicalName + ", it's options are not encoded properly: " + e);
+ }
+ }
+
+ this.physicalName = physicalName;
+ this.destinationPaths = null;
+ this.hashValue = 0;
+ if (composite) {
+ // Check to see if it is a composite.
+ Set<String> l = new HashSet<String>();
+ StringTokenizer iter = new StringTokenizer(physicalName, "" + COMPOSITE_SEPERATOR);
+ while (iter.hasMoreTokens()) {
+ String name = iter.nextToken().trim();
+ if (name.length() == 0) {
+ continue;
+ }
+ l.add(name);
+ }
+ compositeDestinations = new OpenWireDestination[l.size()];
+ int counter = 0;
+ for (String dest : l) {
+ compositeDestinations[counter++] = createDestination(dest);
+ }
+ }
+ }
+
+ public OpenWireDestination createDestination(String name) {
+ return createDestination(name, getDestinationType());
+ }
+
+ public String[] getDestinationPaths() {
+ if (destinationPaths != null) {
+ return destinationPaths;
+ }
+
+ List<String> l = new ArrayList<String>();
+ StringBuilder level = new StringBuilder();
+ final char separator = PATH_SEPERATOR.charAt(0);
+ for (char c : physicalName.toCharArray()) {
+ if (c == separator) {
+ l.add(level.toString());
+ level.delete(0, level.length());
+ } else {
+ level.append(c);
+ }
+ }
+ l.add(level.toString());
+
+ destinationPaths = new String[l.size()];
+ l.toArray(destinationPaths);
+ return destinationPaths;
+ }
+
+ public abstract byte getDestinationType();
+
+ public boolean isQueue() {
+ return false;
+ }
+
+ public boolean isTopic() {
+ return false;
+ }
+
+ public boolean isTemporary() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ OpenWireDestination d = (OpenWireDestination)o;
+ return physicalName.equals(d.physicalName);
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashValue == 0) {
+ hashValue = physicalName.hashCode();
+ }
+ return hashValue;
+ }
+
+ @Override
+ public String toString() {
+ return getQualifiedName();
+ }
+
+ public String getDestinationTypeAsString() {
+ switch (getDestinationType()) {
+ case QUEUE_TYPE:
+ return "Queue";
+ case TOPIC_TYPE:
+ return "Topic";
+ case TEMP_QUEUE_TYPE:
+ return "TempQueue";
+ case TEMP_TOPIC_TYPE:
+ return "TempTopic";
+ default:
+ throw new IllegalArgumentException("Invalid destination type: " + getDestinationType());
+ }
+ }
+
+ public Map<String, String> getOptions() {
+ return options;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ public boolean isPattern() {
+ return isPattern;
+ }
+
+ public static UnresolvedDestinationTransformer getUnresolvableDestinationTransformer() {
+ return unresolvableDestinationTransformer;
+ }
+
+ public static void setUnresolvableDestinationTransformer(UnresolvedDestinationTransformer unresolvableDestinationTransformer) {
+ OpenWireDestination.unresolvableDestinationTransformer = unresolvableDestinationTransformer;
+ }
+
+ private static Map<String, String> parseQuery(String uri) throws Exception {
+ if (uri != null) {
+ Map<String, String> rc = new HashMap<String, String>();
+ if (uri != null) {
+ String[] parameters = uri.split("&");
+ for (int i = 0; i < parameters.length; i++) {
+ int p = parameters[i].indexOf("=");
+ if (p >= 0) {
+ String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
+ String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
+ rc.put(name, value);
+ } else {
+ rc.put(parameters[i], null);
+ }
+ }
+ }
+ return rc;
+ }
+ return Collections.emptyMap();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMapMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMapMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMapMessage.java
new file mode 100644
index 0000000..b828aea
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMapMessage.java
@@ -0,0 +1,296 @@
+/**
+ * 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.commands;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectStreamException;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.InflaterInputStream;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * openwire:marshaller code="25"
+ */
+public class OpenWireMapMessage extends OpenWireMessage {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_MAP_MESSAGE;
+
+ protected transient Map<String, Object> map = new HashMap<String, Object>();
+
+ private Object readResolve() throws ObjectStreamException {
+ if (this.map == null) {
+ this.map = new HashMap<String, Object>();
+ }
+ return this;
+ }
+
+ @Override
+ public OpenWireMapMessage copy() {
+ OpenWireMapMessage copy = new OpenWireMapMessage();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(OpenWireMapMessage copy) {
+ storeContent();
+ super.copy(copy);
+ }
+
+ // We only need to marshal the content if we are hitting the wire.
+ @Override
+ public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
+ super.beforeMarshall(wireFormat);
+ storeContent();
+ }
+
+ @Override
+ public void clearMarshalledState() throws JMSException {
+ super.clearMarshalledState();
+ map.clear();
+ }
+
+ @Override
+ public void storeContentAndClear() {
+ storeContent();
+ map.clear();
+ }
+
+ @Override
+ public void storeContent() {
+ try {
+ if (getContent() == null && !map.isEmpty()) {
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ OutputStream os = bytesOut;
+ if (isUseCompression()) {
+ compressed = true;
+ os = new DeflaterOutputStream(os);
+ }
+ DataOutputStream dataOut = new DataOutputStream(os);
+ OpenWireMarshallingSupport.marshalPrimitiveMap(map, dataOut);
+ dataOut.close();
+ setContent(bytesOut.toBuffer());
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Builds the message body from data
+ *
+ * @throws JMSException
+ * @throws IOException
+ */
+ private void loadContent() throws JMSException {
+ try {
+ if (getContent() != null && map.isEmpty()) {
+ Buffer content = getContent();
+ InputStream is = new ByteArrayInputStream(content);
+ if (isCompressed()) {
+ is = new InflaterInputStream(is);
+ }
+ DataInputStream dataIn = new DataInputStream(is);
+ map = OpenWireMarshallingSupport.unmarshalPrimitiveMap(dataIn);
+ dataIn.close();
+ }
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "jms/map-message";
+ }
+
+ /**
+ * Clears out the message body. Clearing a message's body does not clear its
+ * header values or property entries.
+ * <P>
+ * If this message body was read-only, calling this method leaves the
+ * message body in the same state as an empty body in a newly created
+ * message.
+ */
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ map.clear();
+ }
+
+ /**
+ * Returns the value of the object with the specified name.
+ * <P>
+ * This method can be used to return, in objectified format, an object in
+ * the Java programming language ("Java object") that had been stored in the
+ * Map with the equivalent <CODE>setObject</CODE> method call, or its
+ * equivalent primitive <CODE>set <I>type </I></CODE> method.
+ * <P>
+ * Note that byte values are returned as <CODE>byte[]</CODE>, not
+ * <CODE>Byte[]</CODE>.
+ *
+ * @param name
+ * the name of the Java object
+ *
+ * @return a copy of the Java object value with the specified name, in
+ * objectified format (for example, if the object was set as an
+ * <CODE>int</CODE>, an <CODE>Integer</CODE> is returned); if
+ * there is no item by this name, a null value is returned
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ */
+ public Object getObject(String name) throws JMSException {
+ initializeReading();
+ Object result = getContentMap().get(name);
+ if (result instanceof UTF8Buffer) {
+ result = result.toString();
+ }
+
+ return result;
+ }
+
+ /**
+ * Sets an object value with the specified name into the Map.
+ * <P>
+ * This method works only for the objectified primitive object types
+ * (<code>Integer</code>,<code>Double</code>,<code>Long</code> ...),
+ * <code>String</code> objects, and byte arrays.
+ *
+ * @param name
+ * the name of the Java object
+ * @param value
+ * the Java object value to set in the Map
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws IllegalArgumentException if the name is null or if the name is an
+ * empty string.
+ * @throws MessageFormatException if the object is invalid.
+ */
+ public void setObject(String name, Object value) throws JMSException {
+ initializeWriting();
+ if (value != null) {
+ // byte[] not allowed on properties
+ if (!(value instanceof byte[])) {
+ checkValidObject(value);
+ }
+ put(name, value);
+ } else {
+ put(name, null);
+ }
+ }
+
+ /**
+ * Removes an object value with the specified name into the Map.
+ *
+ * @param name
+ * the name of the Java object
+ *
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws IllegalArgumentException if the name is null or if the name is an
+ * empty string.
+ */
+ public void removeObject(String name) throws JMSException {
+ initializeWriting();
+ if (name == null || name.trim().isEmpty()) {
+ throw new IllegalArgumentException("map element name cannot be null or empty.");
+ }
+
+ this.map.remove(name);
+ }
+
+ /**
+ * Returns an <CODE>Enumeration</CODE> of all the names in the
+ * <CODE>MapMessage</CODE> object.
+ *
+ * @return an enumeration of all the names in this <CODE>MapMessage</CODE>
+ * @throws JMSException
+ */
+ public Enumeration<String> getMapNames() throws JMSException {
+ return Collections.enumeration(getContentMap().keySet());
+ }
+
+ /**
+ * Indicates whether an item exists in this <CODE>MapMessage</CODE>
+ * object.
+ *
+ * @param name the name of the item to test
+ * @return true if the item exists
+ * @throws JMSException if the JMS provider fails to determine if the item
+ * exists due to some internal error.
+ */
+ public boolean itemExists(String name) throws JMSException {
+ return getContentMap().containsKey(name);
+ }
+
+ private void initializeReading() throws JMSException {
+ loadContent();
+ }
+
+ private void initializeWriting() throws MessageNotWriteableException {
+ setContent(null);
+ }
+
+ @Override
+ public void compress() throws IOException {
+ storeContent();
+ super.compress();
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " OpenWireMapMessage{ " + "theTable = " + map + " }";
+ }
+
+ protected Map<String, Object> getContentMap() throws JMSException {
+ initializeReading();
+ return map;
+ }
+
+ protected void put(String name, Object value) throws JMSException {
+ if (name == null) {
+ throw new IllegalArgumentException("The name of the property cannot be null.");
+ }
+ if (name.length() == 0) {
+ throw new IllegalArgumentException("The name of the property cannot be an emprty string.");
+ }
+ map.put(name, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMessage.java
new file mode 100644
index 0000000..12e1d09
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMessage.java
@@ -0,0 +1,405 @@
+/**
+ * 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.commands;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * Base implementation of a JMS Message object.
+ *
+ * openwire:marshaller code="23"
+ */
+public class OpenWireMessage extends Message {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_MESSAGE;
+
+ protected transient boolean useCompression;
+ protected transient boolean nestedMapAndListAllowed;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return String value that represents the MIMI type for the OpenWireMessage type.
+ */
+ public String getMimeType() {
+ return "jms/message";
+ }
+
+ @Override
+ public OpenWireMessage copy() {
+ OpenWireMessage copy = new OpenWireMessage();
+ copy(copy);
+ return copy;
+ }
+
+ protected void copy(OpenWireMessage copy) {
+ copy.useCompression = useCompression;
+ copy.nestedMapAndListAllowed = nestedMapAndListAllowed;
+
+ super.copy(copy);
+ }
+
+ @Override
+ public int hashCode() {
+ MessageId id = getMessageId();
+ if (id != null) {
+ return id.hashCode();
+ } else {
+ return super.hashCode();
+ }
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != getClass()) {
+ return false;
+ }
+
+ OpenWireMessage msg = (OpenWireMessage) o;
+ MessageId oMsg = msg.getMessageId();
+ MessageId thisMsg = this.getMessageId();
+ return thisMsg != null && oMsg != null && oMsg.equals(thisMsg);
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ setContent(null);
+ }
+
+ public String getMessageIdAsString() {
+ MessageId messageId = this.getMessageId();
+ if (messageId == null) {
+ return null;
+ }
+ return messageId.toString();
+ }
+
+ public byte[] getCorrelationIdAsBytes() throws JMSException {
+ return encodeString(this.getCorrelationId());
+ }
+
+ public void setCorrelationIdAsBytes(byte[] correlationId) throws JMSException {
+ this.setCorrelationId(decodeString(correlationId));
+ }
+
+ /**
+ * @returns true if the message has data in its body, false if empty.
+ */
+ public boolean hasContent() {
+ Buffer content = getContent();
+ if (content == null || content.isEmpty()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Provides a fast way to read the message contents.
+ *
+ * This method, unlike the base class getContent method will perform any needed
+ * decompression on a message that was received with a compressed payload.
+ *
+ * @return a the message contents, uncompressed as needed.
+ *
+ * @throws JMSException if an error occurs while accessing the message payload.
+ */
+ public Buffer getPayload() throws JMSException {
+ Buffer data = getContent();
+ if (data == null) {
+ data = new Buffer(new byte[] {}, 0, 0);
+ } else if (isCompressed()) {
+ try {
+ return decompress();
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ return data;
+ }
+
+ /**
+ * Set the contents of this message.
+ *
+ * This method will, unlike the base class setContent method perform any
+ * necessary compression of the given bytes if the message is configured for
+ * message compression.
+ *
+ * @param bytes
+ * the new byte array to use to fill the message body.
+ *
+ * @throws JMSException if an error occurs while accessing the message payload.
+ */
+ public void setPayload(byte[] bytes) throws JMSException {
+ setPayload(new Buffer(bytes));
+ }
+
+ /**
+ * Set the contents of this message.
+ *
+ * This method will, unlike the base class setContent method perform any
+ * necessary compression of the given bytes if the message is configured for
+ * message compression.
+ *
+ * @param buffer
+ * the new byte Buffer to use to fill the message body.
+ *
+ * @throws JMSException if an error occurs while accessing the message payload.
+ */
+ public void setPayload(Buffer buffer) throws JMSException {
+ try {
+ setContent(buffer);
+ if (isUseCompression()) {
+ doCompress();
+ }
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Seems to be invalid because the parameter doesn't initialize MessageId
+ * instance variables ProducerId and ProducerSequenceId
+ *
+ * @param value
+ * the string Message ID value to assign to this message.
+ *
+ * @throws JMSException if an error occurs while parsing the String to a MessageID
+ */
+ public void setMessageId(String value) throws JMSException {
+ if (value != null) {
+ try {
+ MessageId id = new MessageId(value);
+ this.setMessageId(id);
+ } catch (NumberFormatException e) {
+ MessageId id = new MessageId();
+ id.setTextView(value);
+ this.setMessageId(id);
+ }
+ } else {
+ this.setMessageId((MessageId)null);
+ }
+ }
+
+ /**
+ * This will create an object of MessageId. For it to be valid, the instance
+ * variable ProducerId and producerSequenceId must be initialized.
+ *
+ * @param producerId
+ * the ProducerId of the producer that sends this message.
+ * @param producerSequenceId
+ * the logical producer sequence Id of this message.
+ *
+ * @throws JMSException if an error occurs while setting this MessageId
+ */
+ public void setMessageId(ProducerId producerId, long producerSequenceId) throws JMSException {
+ MessageId id = null;
+ try {
+ id = new MessageId(producerId, producerSequenceId);
+ this.setMessageId(id);
+ } catch (Throwable e) {
+ throw ExceptionSupport.create("Invalid message id '" + id + "', reason: " + e.getMessage(), e);
+ }
+ }
+
+ public boolean propertyExists(String name) throws JMSException {
+ try {
+ return (this.getProperties().containsKey(name) || getProperty(name)!= null);
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getPropertyNames() throws JMSException {
+ try {
+ Vector<String> result = new Vector<String>(this.getProperties().keySet());
+ return result.elements();
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ @Override
+ public void setProperty(String name, Object value) throws JMSException {
+ setProperty(name, value, true);
+ }
+
+ /**
+ * Allows for bulk set of Message properties.
+ *
+ * The base method does not attempt to intercept and map JMS specific properties
+ * into the fields of the Message, this is left to any wrapper implementation that
+ * wishes to apply JMS like behavior to the standard OpenWireMessage object.
+ *
+ * @param properties
+ * the properties to set on the Message instance.
+ *
+ * @throws JMSException if an error occurs while setting the properties.
+ */
+ public void setProperties(Map<String, ?> properties) throws JMSException {
+ for (Map.Entry<String, ?> entry : properties.entrySet()) {
+ setProperty(entry.getKey(), entry.getValue());
+ }
+ }
+
+ /**
+ * Allows for unchecked additions to the internal message properties if desired.
+ *
+ * This method is mainly useful for unit testing message types to ensure that get
+ * method fail on conversions from bad types.
+ *
+ * @param name
+ * the name of the property to set
+ * @param value
+ * the new value to assigned to the named property.
+ * @param checkValid
+ * indicates if a type validity check should be performed on the given object.
+ *
+ * @throws JMSException if an error occurs while attempting to set the property value.
+ */
+ public void setProperty(String name, Object value, boolean checkValid) throws JMSException {
+ if (name == null || name.equals("")) {
+ throw new IllegalArgumentException("Property name cannot be empty or null");
+ }
+
+ if (value instanceof UTF8Buffer) {
+ value = value.toString();
+ }
+
+ if (checkValid) {
+ checkValidObject(value);
+ }
+
+ super.setProperty(name, value);
+ }
+
+ /**
+ * @return whether the Message allows for Map and List elements in its properties.
+ */
+ public boolean isNestedMapAndListAllowed() {
+ return nestedMapAndListAllowed;
+ }
+
+ /**
+ * Sets whether the Message will allow for setting a Map or List instance in the
+ * Message properties. By default these elements are not allowed but can added if
+ * this option is set to true.
+ *
+ * @param nestedMapAndListAllowed
+ * true if nested Map and List instances are allowed in Message properties.
+ */
+ public void setNestedMapAndListAllowed(boolean nestedMapAndListAllowed) {
+ this.nestedMapAndListAllowed = nestedMapAndListAllowed;
+ }
+
+ /**
+ * Sets whether the payload of the Message should be compressed.
+ *
+ * @param useCompression
+ * true if the binary payload should be compressed.
+ */
+ public void setUseCompression(boolean useCompression) {
+ this.useCompression = useCompression;
+ }
+
+ /**
+ * @return true if the Message will compress the byte payload.
+ */
+ public boolean isUseCompression() {
+ return useCompression;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processMessage(this);
+ }
+
+ @Override
+ public void storeContent() {
+ }
+
+ @Override
+ public void storeContentAndClear() {
+ storeContent();
+ }
+
+ /**
+ * Method that allows an application to inform the Message instance that it is
+ * about to be sent and that it should prepare its internal state for dispatch.
+ *
+ * @throws JMSException if an error occurs or Message state is invalid.
+ */
+ public void onSend() throws JMSException {
+ }
+
+ protected void checkValidObject(Object value) throws MessageFormatException {
+ boolean valid = value instanceof Boolean || value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long;
+ valid = valid || value instanceof Float || value instanceof Double || value instanceof Character || value instanceof String || value == null;
+
+ if (!valid) {
+ if (isNestedMapAndListAllowed()) {
+ if (!(value instanceof Map || value instanceof List)) {
+ throw new MessageFormatException("Only objectified primitive objects, String, Map and List types are allowed but was: " + value + " type: " + value.getClass());
+ }
+ } else {
+ throw new MessageFormatException("Only objectified primitive objects and String types are allowed but was: " + value + " type: " + value.getClass());
+ }
+ }
+ }
+
+ protected static String decodeString(byte[] data) throws JMSException {
+ try {
+ if (data == null) {
+ return null;
+ }
+ return new String(data, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new JMSException("Invalid UTF-8 encoding: " + e.getMessage());
+ }
+ }
+
+ protected static byte[] encodeString(String data) throws JMSException {
+ try {
+ if (data == null) {
+ return null;
+ }
+ return data.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new JMSException("Invalid UTF-8 encoding: " + e.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireObjectMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireObjectMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireObjectMessage.java
new file mode 100644
index 0000000..4c4a74d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireObjectMessage.java
@@ -0,0 +1,197 @@
+/**
+ * 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.commands;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.InflaterInputStream;
+
+import javax.jms.JMSException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.apache.activemq.openwire.utils.ObjectMessageInputStream;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+
+/**
+ * openwire:marshaller code="26"
+ */
+public class OpenWireObjectMessage extends OpenWireMessage {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_OBJECT_MESSAGE;
+ static final ClassLoader ACTIVEMQ_CLASSLOADER = OpenWireObjectMessage.class.getClassLoader();
+
+ protected transient Serializable object;
+
+ @Override
+ public OpenWireObjectMessage copy() {
+ OpenWireObjectMessage copy = new OpenWireObjectMessage();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(OpenWireObjectMessage copy) {
+ storeContent();
+ copy.object = null;
+ super.copy(copy);
+ }
+
+ @Override
+ public void storeContentAndClear() {
+ storeContent();
+ object = null;
+ }
+
+ @Override
+ public void storeContent() {
+ Buffer bodyAsBytes = getContent();
+ if (bodyAsBytes == null && object != null) {
+ try {
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ OutputStream os = bytesOut;
+ if (isUseCompression()) {
+ compressed = true;
+ os = new DeflaterOutputStream(os);
+ }
+ DataOutputStream dataOut = new DataOutputStream(os);
+ ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
+ objOut.writeObject(object);
+ objOut.flush();
+ objOut.reset();
+ objOut.close();
+ setContent(bytesOut.toBuffer());
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe.getMessage(), ioe);
+ }
+ }
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "jms/object-message";
+ }
+
+ /**
+ * Clears out the message body. Clearing a message's body does not clear its
+ * header values or property entries. <p/>
+ * <P>
+ * If this message body was read-only, calling this method leaves the
+ * message body in the same state as an empty body in a newly created
+ * message.
+ *
+ * @throws JMSException if the JMS provider fails to clear the message body
+ * due to some internal error.
+ */
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ this.object = null;
+ }
+
+ /**
+ * Sets the serializable object containing this message's data. It is
+ * important to note that an <CODE>ObjectMessage</CODE> contains a
+ * snapshot of the object at the time <CODE>setObject()</CODE> is called;
+ * subsequent modifications of the object will have no effect on the
+ * <CODE>ObjectMessage</CODE> body.
+ *
+ * @param newObject the message's data
+ * @throws JMSException if the JMS provider fails to set the object due to
+ * some internal error.
+ * @throws javax.jms.MessageFormatException if object serialization fails.
+ * @throws javax.jms.MessageNotWriteableException if the message is in
+ * read-only mode.
+ */
+ public void setObject(Serializable newObject) throws JMSException {
+ this.object = newObject;
+ setContent(null);
+ storeContent();
+ }
+
+ /**
+ * Gets the serializable object containing this message's data. The default
+ * value is null.
+ *
+ * @return the serializable object containing this message's data
+ * @throws JMSException
+ */
+ public Serializable getObject() throws JMSException {
+ if (object == null && getContent() != null) {
+ try {
+ Buffer content = getContent();
+ InputStream is = new ByteArrayInputStream(content);
+ if (isCompressed()) {
+ is = new InflaterInputStream(is);
+ }
+ DataInputStream dataIn = new DataInputStream(is);
+ ObjectMessageInputStream objIn = new ObjectMessageInputStream(dataIn);
+ try {
+ object = (Serializable)objIn.readObject();
+ } catch (ClassNotFoundException ce) {
+ throw ExceptionSupport.create("Failed to build body from content. Serializable class not available to broker. Reason: " + ce, ce);
+ } finally {
+ dataIn.close();
+ objIn.close();
+ }
+ } catch (IOException e) {
+ throw ExceptionSupport.create("Failed to build body from bytes. Reason: " + e, e);
+ }
+ }
+ return this.object;
+ }
+
+ @Override
+ public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
+ super.beforeMarshall(wireFormat);
+ storeContent();
+ }
+
+ @Override
+ public void clearMarshalledState() throws JMSException {
+ super.clearMarshalledState();
+ this.object = null;
+ }
+
+ @Override
+ public void compress() throws IOException {
+ storeContent();
+ super.compress();
+ }
+
+ @Override
+ public String toString() {
+ try {
+ getObject();
+ } catch (JMSException e) {
+ }
+ return super.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireQueue.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireQueue.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireQueue.java
new file mode 100644
index 0000000..67b87e1
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireQueue.java
@@ -0,0 +1,61 @@
+/**
+ * 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.commands;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+
+
+/**
+ * @openwire:marshaller code="100"
+ */
+public class OpenWireQueue extends OpenWireDestination implements Queue {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_QUEUE;
+
+ public OpenWireQueue() {
+ }
+
+ public OpenWireQueue(String name) {
+ super(name);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isQueue() {
+ return true;
+ }
+
+ @Override
+ public byte getDestinationType() {
+ return QUEUE_TYPE;
+ }
+
+ @Override
+ protected String getQualifiedPrefix() {
+ return QUEUE_QUALIFIED_PREFIX;
+ }
+
+ @Override
+ public String getQueueName() throws JMSException {
+ return getPhysicalName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireStreamMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireStreamMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireStreamMessage.java
new file mode 100644
index 0000000..fa0660f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireStreamMessage.java
@@ -0,0 +1,229 @@
+/**
+ * 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.commands;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.EOFException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.jms.JMSException;
+
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+
+/**
+ * openwire:marshaller code="27"
+ */
+public class OpenWireStreamMessage extends OpenWireMessage {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_STREAM_MESSAGE;
+
+ @Override
+ public OpenWireStreamMessage copy() {
+ OpenWireStreamMessage copy = new OpenWireStreamMessage();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(OpenWireStreamMessage copy) {
+ storeContent();
+ super.copy(copy);
+ }
+
+ @Override
+ public void onSend() throws JMSException {
+ super.onSend();
+ storeContent();
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "jms/stream-message";
+ }
+
+ /**
+ * Reads the contents of the StreamMessage instances into a single List<Object> instance
+ * and returns it. The read starts from the current position of the message which implies
+ * that the list might not be a complete view of the message if any prior read operations
+ * were invoked.
+ *
+ * @return a List containing the objects store in this message starting from the current position.
+ *
+ * @throws JMSException if an error occurs while reading the message.
+ */
+ public List<Object> readStreamToList() throws JMSException {
+ if (!hasContent()) {
+ return Collections.emptyList();
+ }
+
+ Buffer payload = getPayload();
+ DataByteArrayInputStream dataIn = new DataByteArrayInputStream(payload);
+
+ List<Object> result = new ArrayList<Object>();
+ while (true) {
+ try {
+ result.add(readNextElement(dataIn));
+ } catch (EOFException ex) {
+ break;
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Given a DataInput instance, attempt to read OpenWireStreamMessage formatted values
+ * and returned the next element.
+ *
+ * @param input
+ * the input stream that contains the marshaled bytes.
+ *
+ * @return the next element encoded in the stream.
+ *
+ * @throws IOException if an error occurs while reading the next element from the stream
+ * @throws EOFException
+ */
+ protected Object readNextElement(DataInput input) throws IOException {
+ int type = input.readByte();
+ if (type == -1) {
+ throw new EOFException("Reached end of stream.");
+ }
+
+ if (type == OpenWireMarshallingSupport.NULL) {
+ return null;
+ } else if (type == OpenWireMarshallingSupport.BIG_STRING_TYPE) {
+ return OpenWireMarshallingSupport.readUTF8(input);
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return input.readUTF();
+ } else if (type == OpenWireMarshallingSupport.LONG_TYPE) {
+ return Long.valueOf(input.readLong());
+ } else if (type == OpenWireMarshallingSupport.INTEGER_TYPE) {
+ return Integer.valueOf(input.readInt());
+ } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
+ return Short.valueOf(input.readShort());
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return Byte.valueOf(input.readByte());
+ } else if (type == OpenWireMarshallingSupport.FLOAT_TYPE) {
+ return new Float(input.readFloat());
+ } else if (type == OpenWireMarshallingSupport.DOUBLE_TYPE) {
+ return new Double(input.readDouble());
+ } else if (type == OpenWireMarshallingSupport.BOOLEAN_TYPE) {
+ return input.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
+ } else if (type == OpenWireMarshallingSupport.CHAR_TYPE) {
+ return Character.valueOf(input.readChar());
+ } else if (type == OpenWireMarshallingSupport.BYTE_ARRAY_TYPE) {
+ int len = input.readInt();
+ byte[] value = new byte[len];
+ input.readFully(value);
+ return value;
+ } else {
+ throw new IOException("unknown type read from encoded stream.");
+ }
+ }
+
+ /**
+ * Writes the given set of Objects to the messages stream. The elements in the list
+ * must adhere to the supported types of a JMS StreamMessage or an exception will be
+ * thrown.
+ *
+ * @param elements
+ * the list of elements to store into the list.
+ *
+ * @throws JMSException if an error occurs while writing the elements to the message.
+ */
+ public void writeListToStream(List<Object> elements) throws JMSException {
+ if (elements != null && !elements.isEmpty()) {
+ DataByteArrayOutputStream output = new DataByteArrayOutputStream();
+ for (Object value : elements) {
+ try {
+ writeElement(value, output);
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+ try {
+ output.close();
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+
+ setPayload(output.toBuffer());
+ }
+ }
+
+ /**
+ * Encodes the given object into the OpenWire marshaled form and writes it to the
+ * given DataOutput instance. Each element is written with a type identifier to
+ * allow for easy unmarshaling.
+ *
+ * @param value
+ * @param output
+ * @throws IOException
+ */
+ protected void writeElement(Object value, DataOutput output) throws IOException {
+ if (value == null) {
+ OpenWireMarshallingSupport.marshalNull(output);
+ } else if (value instanceof String) {
+ OpenWireMarshallingSupport.marshalString(output, (String) value);
+ } else if (value instanceof Character) {
+ OpenWireMarshallingSupport.marshalChar(output, (Character) value);
+ } else if (value instanceof Boolean) {
+ OpenWireMarshallingSupport.marshalBoolean(output, (Boolean) value);
+ } else if (value instanceof Byte) {
+ OpenWireMarshallingSupport.marshalByte(output, (Byte) value);
+ } else if (value instanceof Short) {
+ OpenWireMarshallingSupport.marshalShort(output, (Short) value);
+ } else if (value instanceof Integer) {
+ OpenWireMarshallingSupport.marshalInt(output, (Integer) value);
+ } else if (value instanceof Float) {
+ OpenWireMarshallingSupport.marshalFloat(output, (Float) value);
+ } else if (value instanceof Double) {
+ OpenWireMarshallingSupport.marshalDouble(output, (Double) value);
+ } else if (value instanceof byte[]) {
+ OpenWireMarshallingSupport.marshalByteArray(output, (byte[]) value, 0, ((byte[]) value).length);
+ } else if (value instanceof Long) {
+ OpenWireMarshallingSupport.marshalLong(output, (Long) value);
+ } else {
+ throw new IOException("Unsupported Object type: " + value.getClass());
+ }
+ }
+
+ @Override
+ public void compress() throws IOException {
+ storeContent();
+ super.compress();
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " OpenWireStreamMessage{}";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempDestination.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempDestination.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempDestination.java
new file mode 100644
index 0000000..f9ba499
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempDestination.java
@@ -0,0 +1,96 @@
+/**
+ * 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.commands;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class for the Temporary Destination types.
+ *
+ * @openwire:marshaller
+ */
+public abstract class OpenWireTempDestination extends OpenWireDestination {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireTempDestination.class);
+
+ protected transient String connectionId;
+ protected transient int sequenceId;
+
+ public OpenWireTempDestination() {
+ }
+
+ public OpenWireTempDestination(String name) {
+ super(name);
+ }
+
+ public OpenWireTempDestination(String connectionId, long sequenceId) {
+ super(connectionId + ":" + sequenceId);
+ }
+
+ @Override
+ public boolean isTemporary() {
+ return true;
+ }
+
+ @Override
+ public void setPhysicalName(String physicalName) {
+ super.setPhysicalName(physicalName);
+ if (!isComposite()) {
+ // Parse off the sequenceId off the end. this can fail if the temporary destination is
+ // generated by another JMS system via the JMS<->JMS Bridge
+ int p = this.physicalName.lastIndexOf(":");
+ if (p >= 0) {
+ String seqStr = this.physicalName.substring(p + 1).trim();
+ if (seqStr != null && seqStr.length() > 0) {
+ try {
+ sequenceId = Integer.parseInt(seqStr);
+ } catch (NumberFormatException e) {
+ LOG.debug("Did not parse sequence Id from {}", physicalName);
+ }
+
+ // The rest should be the connection id.
+ connectionId = this.physicalName.substring(0, p);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the ConnectionId that created this Temporary Destination
+ */
+ public String getConnectionId() {
+ return connectionId;
+ }
+
+ /**
+ * Sets the ConnectionId String for the connection that created this Temporary Destination.
+ *
+ * @param connectionId
+ * the ConnectionId String of the parent Connection.
+ */
+ public void setConnectionId(String connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @return the sequence Id used to generate this Temporary Destination.
+ */
+ public int getSequenceId() {
+ return sequenceId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempQueue.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempQueue.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempQueue.java
new file mode 100644
index 0000000..13f4c1b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempQueue.java
@@ -0,0 +1,71 @@
+/**
+ * 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.commands;
+
+import javax.jms.JMSException;
+import javax.jms.TemporaryQueue;
+
+
+/**
+ * Represents an ActiveMQ Temporary Queue.
+ *
+ * @openwire:marshaller code="102"
+ */
+public class OpenWireTempQueue extends OpenWireTempDestination implements TemporaryQueue {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_TEMP_QUEUE;
+
+ public OpenWireTempQueue() {
+ }
+
+ public OpenWireTempQueue(String name) {
+ super(name);
+ }
+
+ public OpenWireTempQueue(ConnectionId connectionId, long sequenceId) {
+ super(connectionId.getValue(), sequenceId);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isQueue() {
+ return true;
+ }
+
+ @Override
+ public byte getDestinationType() {
+ return TEMP_QUEUE_TYPE;
+ }
+
+ @Override
+ protected String getQualifiedPrefix() {
+ return TEMP_QUEUE_QUALIFED_PREFIX;
+ }
+
+ @Override
+ public String getQueueName() throws JMSException {
+ return getPhysicalName();
+ }
+
+ @Override
+ public void delete() throws JMSException {
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempTopic.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempTopic.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempTopic.java
new file mode 100644
index 0000000..321bd7a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTempTopic.java
@@ -0,0 +1,69 @@
+/**
+ * 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.commands;
+
+import javax.jms.JMSException;
+import javax.jms.TemporaryTopic;
+
+/**
+ * @openwire:marshaller code="103"
+ */
+public class OpenWireTempTopic extends OpenWireTempDestination implements TemporaryTopic {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_TEMP_TOPIC;
+
+ public OpenWireTempTopic() {
+ }
+
+ public OpenWireTempTopic(String name) {
+ super(name);
+ }
+
+ public OpenWireTempTopic(ConnectionId connectionId, long sequenceId) {
+ super(connectionId.getValue(), sequenceId);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isTopic() {
+ return true;
+ }
+
+ @Override
+ public byte getDestinationType() {
+ return TEMP_TOPIC_TYPE;
+ }
+
+ @Override
+ protected String getQualifiedPrefix() {
+ return TEMP_TOPIC_QUALIFED_PREFIX;
+ }
+
+ @Override
+ public String getTopicName() throws JMSException {
+ return getPhysicalName();
+ }
+
+ @Override
+ public void delete() throws JMSException {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTextMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTextMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTextMessage.java
new file mode 100644
index 0000000..09c9223
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTextMessage.java
@@ -0,0 +1,183 @@
+/**
+ * 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.commands;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+
+/**
+ * openwire:marshaller code="28"
+ */
+public class OpenWireTextMessage extends OpenWireMessage {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_TEXT_MESSAGE;
+
+ protected String text;
+
+ @Override
+ public OpenWireTextMessage copy() {
+ OpenWireTextMessage copy = new OpenWireTextMessage();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(OpenWireTextMessage copy) {
+ super.copy(copy);
+ copy.text = text;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "jms/text-message";
+ }
+
+ public void setText(String text) throws MessageNotWriteableException {
+ this.text = text;
+ setContent(null);
+ }
+
+ public String getText() throws JMSException {
+ if (text == null && getContent() != null) {
+ text = decodeContent();
+ setContent(null);
+ }
+ return text;
+ }
+
+ private String decodeContent() throws JMSException {
+ String text = null;
+ if (hasContent()) {
+ InputStream is = null;
+ try {
+ is = new ByteArrayInputStream(getPayload());
+ DataInputStream dataIn = new DataInputStream(is);
+ text = OpenWireMarshallingSupport.readUTF8(dataIn);
+ dataIn.close();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+ return text;
+ }
+
+ @Override
+ public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
+ super.beforeMarshall(wireFormat);
+ storeContent();
+ }
+
+ @Override
+ public void storeContentAndClear() {
+ storeContent();
+ text = null;
+ }
+
+ @Override
+ public void storeContent() {
+ try {
+ Buffer content = getContent();
+ if (content == null && text != null) {
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ OutputStream os = bytesOut;
+ DataOutputStream dataOut = new DataOutputStream(os);
+ OpenWireMarshallingSupport.writeUTF8(dataOut, this.text);
+ dataOut.close();
+ setPayload(bytesOut.toBuffer());
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void clearMarshalledState() throws JMSException {
+ super.clearMarshalledState();
+ this.text = null;
+ }
+
+ /**
+ * Clears out the message body. Clearing a message's body does not clear its
+ * header values or property entries. <p/>
+ * <P>
+ * If this message body was read-only, calling this method leaves the
+ * message body in the same state as an empty body in a newly created
+ * message.
+ *
+ * @throws JMSException if the JMS provider fails to clear the message body
+ * due to some internal error.
+ */
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ this.text = null;
+ }
+
+ @Override
+ public int getSize() {
+ if (size == 0 && content == null && text != null) {
+ size = DEFAULT_MINIMUM_MESSAGE_SIZE;
+ if (marshalledProperties != null) {
+ size += marshalledProperties.getLength();
+ }
+ size += text.length() * 2;
+ }
+ return super.getSize();
+ }
+
+ @Override
+ public String toString() {
+ String text = this.text;
+ if( text == null ) {
+ try {
+ text = decodeContent();
+ } catch (JMSException ex) {
+ }
+ }
+ if (text != null) {
+ text = OpenWireMarshallingSupport.truncate64(text);
+ return getClass().getSimpleName() + " { text = " + text + " }";
+ } else {
+ return getClass().getSimpleName() + " { text = null }";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTopic.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTopic.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTopic.java
new file mode 100644
index 0000000..8bf6500
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireTopic.java
@@ -0,0 +1,60 @@
+/**
+ * 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.commands;
+
+import javax.jms.JMSException;
+import javax.jms.Topic;
+
+/**
+ * @openwire:marshaller code="101"
+ */
+public class OpenWireTopic extends OpenWireDestination implements Topic {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_TOPIC;
+
+ public OpenWireTopic() {
+ }
+
+ public OpenWireTopic(String name) {
+ super(name);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isTopic() {
+ return true;
+ }
+
+ @Override
+ public String getTopicName() throws JMSException {
+ return getPhysicalName();
+ }
+
+ @Override
+ public byte getDestinationType() {
+ return TOPIC_TYPE;
+ }
+
+ @Override
+ protected String getQualifiedPrefix() {
+ return TOPIC_QUALIFIED_PREFIX;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/PartialCommand.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/PartialCommand.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/PartialCommand.java
new file mode 100644
index 0000000..030f3a8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/PartialCommand.java
@@ -0,0 +1,158 @@
+/**
+ * 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.commands;
+
+/**
+ * Represents a partial command; a large command that has been split up into
+ * pieces.
+ *
+ * @openwire:marshaller code="60"
+ */
+public class PartialCommand implements Command {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.PARTIAL_COMMAND;
+
+ private int commandId;
+ private byte[] data;
+
+ public PartialCommand() {
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ @Override
+ public int getCommandId() {
+ return commandId;
+ }
+
+ @Override
+ public void setCommandId(int commandId) {
+ this.commandId = commandId;
+ }
+
+ /**
+ * The data for this part of the command
+ *
+ * @openwire:property version=1 mandatory=true
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ public void setData(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ throw new IllegalStateException("The transport layer should filter out PartialCommand instances but received: " + this);
+ }
+
+ @Override
+ public boolean isResponseRequired() {
+ return false;
+ }
+
+ @Override
+ public boolean isResponse() {
+ return false;
+ }
+
+ @Override
+ public boolean isBrokerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatch() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessage() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageAck() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatchNotification() {
+ return false;
+ }
+
+ @Override
+ public boolean isShutdownInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectionControl() {
+ return false;
+ }
+
+ @Override
+ public void setResponseRequired(boolean responseRequired) {
+ }
+
+ @Override
+ public boolean isWireFormatInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectionInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isSessionInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isProducerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isConsumerInfo() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ int size = 0;
+ if (data != null) {
+ size = data.length;
+ }
+ return "PartialCommand[id: " + commandId + " data: " + size + " byte(s)]";
+ }
+}
[16/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..37af7f2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..84a17b6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTextMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..508d6bf
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..64b0d13
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/PartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/PartialCommandMarshaller.java
new file mode 100644
index 0000000..b7ab177
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerAckMarshaller.java
new file mode 100644
index 0000000..dfd2da4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerIdMarshaller.java
new file mode 100644
index 0000000..d4cde6a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerIdMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..6ac9fc8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..dc1066e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveInfoMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveSubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..a812af9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v4;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ReplayCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..a931189
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ResponseMarshaller.java
new file mode 100644
index 0000000..62251c2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ResponseMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionIdMarshaller.java
new file mode 100644
index 0000000..b868a06
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionIdMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionInfoMarshaller.java
new file mode 100644
index 0000000..c2ff037
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SessionInfoMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ShutdownInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..0ea40e0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..7a2371d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionIdMarshaller.java
new file mode 100644
index 0000000..5eff83b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v4;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[37/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ExceptionResponse.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ExceptionResponse.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ExceptionResponse.java
new file mode 100644
index 0000000..07789ac
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ExceptionResponse.java
@@ -0,0 +1,55 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="31"
+ */
+public class ExceptionResponse extends Response {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.EXCEPTION_RESPONSE;
+
+ Throwable exception;
+
+ public ExceptionResponse() {
+ }
+
+ public ExceptionResponse(Throwable e) {
+ setException(e);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public Throwable getException() {
+ return exception;
+ }
+
+ public void setException(Throwable exception) {
+ this.exception = exception;
+ }
+
+ @Override
+ public boolean isException() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/FlushCommand.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/FlushCommand.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/FlushCommand.java
new file mode 100644
index 0000000..6625ff7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/FlushCommand.java
@@ -0,0 +1,38 @@
+/**
+ * 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.commands;
+
+/**
+ * An indication to the transport layer that a flush is required.
+ *
+ * @openwire:marshaller code="15"
+ */
+public class FlushCommand extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.FLUSH_COMMAND;
+ public static final Command COMMAND = new FlushCommand();
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processFlush(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/IntegerResponse.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/IntegerResponse.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/IntegerResponse.java
new file mode 100644
index 0000000..f33dc02
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/IntegerResponse.java
@@ -0,0 +1,50 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="34"
+ */
+public class IntegerResponse extends Response {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.INTEGER_RESPONSE;
+
+ int result;
+
+ public IntegerResponse() {
+ }
+
+ public IntegerResponse(int result) {
+ this.result = result;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public int getResult() {
+ return result;
+ }
+
+ public void setResult(int result) {
+ this.result = result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalQueueAck.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalQueueAck.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalQueueAck.java
new file mode 100644
index 0000000..4594461
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalQueueAck.java
@@ -0,0 +1,65 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="52"
+ */
+public class JournalQueueAck implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.JOURNAL_REMOVE;
+
+ OpenWireDestination destination;
+ MessageAck messageAck;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public MessageAck getMessageAck() {
+ return messageAck;
+ }
+
+ public void setMessageAck(MessageAck messageAck) {
+ this.messageAck = messageAck;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "{ " + destination + " }";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTopicAck.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTopicAck.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTopicAck.java
new file mode 100644
index 0000000..032dff0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTopicAck.java
@@ -0,0 +1,113 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="50"
+ */
+public class JournalTopicAck implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.JOURNAL_ACK;
+
+ protected OpenWireDestination destination;
+ protected String clientId;
+ protected String subscritionName;
+ protected MessageId messageId;
+ protected long messageSequenceId;
+ protected TransactionId transactionId;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public MessageId getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(MessageId messageId) {
+ this.messageId = messageId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getMessageSequenceId() {
+ return messageSequenceId;
+ }
+
+ public void setMessageSequenceId(long messageSequenceId) {
+ this.messageSequenceId = messageSequenceId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getSubscritionName() {
+ return subscritionName;
+ }
+
+ public void setSubscritionName(String subscritionName) {
+ this.subscritionName = subscritionName;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public TransactionId getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(TransactionId transaction) {
+ this.transactionId = transaction;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "{ " + destination + " }";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTrace.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTrace.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTrace.java
new file mode 100644
index 0000000..ebc4746
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTrace.java
@@ -0,0 +1,63 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="53"
+ */
+public class JournalTrace implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.JOURNAL_TRACE;
+
+ private String message;
+
+ public JournalTrace() {
+ }
+
+ public JournalTrace(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " { " + message + " }";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTransaction.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTransaction.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTransaction.java
new file mode 100644
index 0000000..8df4ccf
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/JournalTransaction.java
@@ -0,0 +1,92 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="54"
+ */
+public class JournalTransaction implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.JOURNAL_TRANSACTION;
+
+ public static final byte XA_PREPARE = 1;
+ public static final byte XA_COMMIT = 2;
+ public static final byte XA_ROLLBACK = 3;
+ public static final byte LOCAL_COMMIT = 4;
+ public static final byte LOCAL_ROLLBACK = 5;
+
+ public byte type;
+ public boolean wasPrepared;
+ public TransactionId transactionId;
+
+ public JournalTransaction(byte type, TransactionId transactionId, boolean wasPrepared) {
+ this.type = type;
+ this.transactionId = transactionId;
+ this.wasPrepared = wasPrepared;
+ }
+
+ public JournalTransaction() {
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public TransactionId getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(TransactionId transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public byte getType() {
+ return type;
+ }
+
+ public void setType(byte type) {
+ this.type = type;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean getWasPrepared() {
+ return wasPrepared;
+ }
+
+ public void setWasPrepared(boolean wasPrepared) {
+ this.wasPrepared = wasPrepared;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " { " + transactionId + " }";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/KeepAliveInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/KeepAliveInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/KeepAliveInfo.java
new file mode 100644
index 0000000..270475b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/KeepAliveInfo.java
@@ -0,0 +1,85 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="10"
+ */
+public class KeepAliveInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.KEEP_ALIVE_INFO;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isResponse() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatch() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessage() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageAck() {
+ return false;
+ }
+
+ @Override
+ public boolean isBrokerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isWireFormatInfo() {
+ return false;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processKeepAlive(this);
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatchNotification() {
+ return false;
+ }
+
+ @Override
+ public boolean isShutdownInfo() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LastPartialCommand.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LastPartialCommand.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LastPartialCommand.java
new file mode 100644
index 0000000..cc49d63
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LastPartialCommand.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commands;
+
+/**
+ * Represents the end marker of a stream of {@link PartialCommand} instances.
+ *
+ * @openwire:marshaller code="61"
+ */
+public class LastPartialCommand extends PartialCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.PARTIAL_LAST_COMMAND;
+
+ public LastPartialCommand() {
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ throw new IllegalStateException("The transport layer should filter out LastPartialCommand instances but received: " + this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LocalTransactionId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LocalTransactionId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LocalTransactionId.java
new file mode 100644
index 0000000..ed5f5d4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/LocalTransactionId.java
@@ -0,0 +1,125 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="111"
+ *
+ */
+public class LocalTransactionId extends TransactionId implements Comparable<LocalTransactionId> {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_LOCAL_TRANSACTION_ID;
+
+ protected ConnectionId connectionId;
+ protected long value;
+
+ private transient String transactionKey;
+ private transient int hashCode;
+
+ public LocalTransactionId() {
+ }
+
+ public LocalTransactionId(ConnectionId connectionId, long transactionId) {
+ this.connectionId = connectionId;
+ this.value = transactionId;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isXATransaction() {
+ return false;
+ }
+
+ @Override
+ public boolean isLocalTransaction() {
+ return true;
+ }
+
+ @Override
+ public String getTransactionKey() {
+ if (transactionKey == null) {
+ transactionKey = "TX:" + connectionId + ":" + value;
+ }
+ return transactionKey;
+ }
+
+ @Override
+ public String toString() {
+ return getTransactionKey();
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ hashCode = connectionId.hashCode() ^ (int)value;
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != LocalTransactionId.class) {
+ return false;
+ }
+ LocalTransactionId tx = (LocalTransactionId)o;
+ return value == tx.value && connectionId.equals(tx.connectionId);
+ }
+
+ /**
+ * @param o
+ * @return
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(LocalTransactionId o) {
+ int result = connectionId.compareTo(o.connectionId);
+ if (result == 0) {
+ result = (int)(value - o.value);
+ }
+ return result;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getValue() {
+ return value;
+ }
+
+ public void setValue(long transactionId) {
+ this.value = transactionId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MarshallAware.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MarshallAware.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MarshallAware.java
new file mode 100644
index 0000000..26405f4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MarshallAware.java
@@ -0,0 +1,33 @@
+/**
+ * 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.commands;
+
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public interface MarshallAware {
+
+ void beforeMarshall(OpenWireFormat wireFormat) throws IOException;
+
+ void afterMarshall(OpenWireFormat wireFormat) throws IOException;
+
+ void beforeUnmarshall(OpenWireFormat wireFormat) throws IOException;
+
+ void afterUnmarshall(OpenWireFormat wireFormat) throws IOException;
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Message.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Message.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Message.java
new file mode 100644
index 0000000..b691f93
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Message.java
@@ -0,0 +1,718 @@
+/**
+ * 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.commands;
+
+import static org.apache.activemq.openwire.codec.OpenWireConstants.ADIVSORY_MESSAGE_TYPE;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.InflaterInputStream;
+
+import javax.jms.JMSException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * Represents an ActiveMQ message
+ *
+ * @openwire:marshaller
+ */
+public abstract class Message extends BaseCommand implements MarshallAware {
+
+ public static final String ORIGINAL_EXPIRATION = "originalExpiration";
+
+ /**
+ * The default minimum amount of memory a message is assumed to use
+ */
+ public static final int DEFAULT_MINIMUM_MESSAGE_SIZE = 1024;
+
+ protected MessageId messageId;
+ protected OpenWireDestination originalDestination;
+ protected TransactionId originalTransactionId;
+
+ protected ProducerId producerId;
+ protected OpenWireDestination destination;
+ protected TransactionId transactionId;
+
+ protected long expiration;
+ protected long timestamp;
+ protected long arrival;
+ protected long brokerInTime;
+ protected long brokerOutTime;
+ protected String correlationId;
+ protected OpenWireDestination replyTo;
+ protected boolean persistent;
+ protected String type;
+ protected byte priority;
+ protected String groupId;
+ protected int groupSequence;
+ protected ConsumerId targetConsumerId;
+ protected boolean compressed;
+ protected String userId;
+
+ protected Buffer content;
+ protected Buffer marshalledProperties;
+ protected DataStructure dataStructure;
+ protected int redeliveryCounter;
+
+ protected int size;
+ protected Map<String, Object> properties;
+ protected transient boolean recievedByDFBridge;
+ protected boolean droppable;
+ protected boolean jmsXGroupFirstForConsumer;
+
+ private BrokerId[] brokerPath;
+ private BrokerId[] cluster;
+
+ public abstract Message copy();
+ public abstract void clearBody() throws JMSException;
+ public abstract void storeContent();
+ public abstract void storeContentAndClear();
+
+ // useful to reduce the memory footprint of a persisted message
+ public void clearMarshalledState() throws JMSException {
+ properties = null;
+ }
+
+ protected void copy(Message copy) {
+ super.copy(copy);
+ copy.producerId = producerId;
+ copy.transactionId = transactionId;
+ copy.destination = destination;
+ copy.messageId = messageId != null ? messageId.copy() : null;
+ copy.originalDestination = originalDestination;
+ copy.originalTransactionId = originalTransactionId;
+ copy.expiration = expiration;
+ copy.timestamp = timestamp;
+ copy.correlationId = correlationId;
+ copy.replyTo = replyTo;
+ copy.persistent = persistent;
+ copy.redeliveryCounter = redeliveryCounter;
+ copy.type = type;
+ copy.priority = priority;
+ copy.size = size;
+ copy.groupId = groupId;
+ copy.userId = userId;
+ copy.groupSequence = groupSequence;
+
+ if (properties != null) {
+ copy.properties = new HashMap<String, Object>(properties);
+
+ // The new message hasn't expired, so remove this feild.
+ copy.properties.remove(ORIGINAL_EXPIRATION);
+ } else {
+ copy.properties = properties;
+ }
+
+ copy.content = content;
+ copy.marshalledProperties = marshalledProperties;
+ copy.dataStructure = dataStructure;
+ copy.compressed = compressed;
+ copy.recievedByDFBridge = recievedByDFBridge;
+
+ copy.arrival = arrival;
+ copy.brokerInTime = brokerInTime;
+ copy.brokerOutTime = brokerOutTime;
+ copy.brokerPath = brokerPath;
+ copy.jmsXGroupFirstForConsumer = jmsXGroupFirstForConsumer;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map<String, Object> getProperties() throws IOException {
+ if (properties == null) {
+ if (marshalledProperties == null) {
+ return Collections.EMPTY_MAP;
+ }
+ properties = unmarsallProperties(marshalledProperties);
+ }
+ return Collections.unmodifiableMap(properties);
+ }
+
+ public void clearProperties() throws JMSException {
+ marshalledProperties = null;
+ properties = null;
+ }
+
+ public Object getProperty(String name) throws JMSException {
+ if (properties == null) {
+ if (marshalledProperties == null) {
+ return null;
+ }
+ try {
+ properties = unmarsallProperties(marshalledProperties);
+ } catch (IOException e) {
+ throw ExceptionSupport.create("Error during properties unmarshal, reason: " + e.getMessage(), e);
+ }
+ }
+ Object result = properties.get(name);
+ if (result instanceof UTF8Buffer) {
+ result = result.toString();
+ }
+
+ return result;
+ }
+
+ public void setProperty(String name, Object value) throws JMSException {
+ lazyCreateProperties();
+ properties.put(name, value);
+ }
+
+ public void removeProperty(String name) throws JMSException {
+ lazyCreateProperties();
+ properties.remove(name);
+ }
+
+ protected void lazyCreateProperties() throws JMSException {
+ if (properties == null) {
+ if (marshalledProperties == null) {
+ properties = new HashMap<String, Object>();
+ } else {
+ try {
+ properties = unmarsallProperties(marshalledProperties);
+ } catch (IOException e) {
+ throw ExceptionSupport.create(
+ "Error during properties unmarshal, reason: " + e.getMessage(), e);
+ }
+ marshalledProperties = null;
+ }
+ } else {
+ marshalledProperties = null;
+ }
+ }
+
+ private Map<String, Object> unmarsallProperties(Buffer marshalledProperties) throws IOException {
+ return OpenWireMarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)));
+ }
+
+ @Override
+ public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
+ // Need to marshal the properties.
+ if (marshalledProperties == null && properties != null) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream os = new DataOutputStream(baos);
+ OpenWireMarshallingSupport.marshalPrimitiveMap(properties, os);
+ os.close();
+ marshalledProperties = baos.toBuffer();
+ }
+ }
+
+ @Override
+ public void afterMarshall(OpenWireFormat wireFormat) throws IOException {
+ }
+
+ @Override
+ public void beforeUnmarshall(OpenWireFormat wireFormat) throws IOException {
+ }
+
+ @Override
+ public void afterUnmarshall(OpenWireFormat wireFormat) throws IOException {
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ProducerId getProducerId() {
+ return producerId;
+ }
+
+ public void setProducerId(ProducerId producerId) {
+ this.producerId = producerId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public TransactionId getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(TransactionId transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public boolean isInTransaction() {
+ return transactionId != null;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getOriginalDestination() {
+ return originalDestination;
+ }
+
+ public void setOriginalDestination(OpenWireDestination destination) {
+ this.originalDestination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public MessageId getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(MessageId messageId) {
+ this.messageId = messageId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public TransactionId getOriginalTransactionId() {
+ return originalTransactionId;
+ }
+
+ public void setOriginalTransactionId(TransactionId transactionId) {
+ this.originalTransactionId = transactionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupID(String groupId) {
+ this.groupId = groupId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public int getGroupSequence() {
+ return groupSequence;
+ }
+
+ public void setGroupSequence(int groupSequence) {
+ this.groupSequence = groupSequence;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public void setCorrelationId(String correlationId) {
+ this.correlationId = correlationId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean isPersistent() {
+ return persistent;
+ }
+
+ public void setPersistent(boolean deliveryMode) {
+ this.persistent = deliveryMode;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getExpiration() {
+ return expiration;
+ }
+
+ public void setExpiration(long expiration) {
+ this.expiration = expiration;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public byte getPriority() {
+ return priority;
+ }
+
+ public void setPriority(byte priority) {
+ if (priority < 0) {
+ this.priority = 0;
+ } else if (priority > 9) {
+ this.priority = 9;
+ } else {
+ this.priority = priority;
+ }
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public OpenWireDestination getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(OpenWireDestination replyTo) {
+ this.replyTo = replyTo;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public Buffer getContent() {
+ return content;
+ }
+
+ public void setContent(Buffer content) {
+ this.content = content;
+ if (content == null) {
+ compressed = false;
+ }
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public Buffer getMarshalledProperties() {
+ return marshalledProperties;
+ }
+
+ public void setMarshalledProperties(Buffer marshalledProperties) {
+ this.marshalledProperties = marshalledProperties;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public DataStructure getDataStructure() {
+ return dataStructure;
+ }
+
+ public void setDataStructure(DataStructure data) {
+ this.dataStructure = data;
+ }
+
+ /**
+ * Can be used to route the message to a specific consumer. Should be null
+ * to allow the broker use normal JMS routing semantics. If the target
+ * consumer id is an active consumer on the broker, the message is dropped.
+ * Used by the AdvisoryBroker to replay advisory messages to a specific
+ * consumer.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public ConsumerId getTargetConsumerId() {
+ return targetConsumerId;
+ }
+
+ public void setTargetConsumerId(ConsumerId targetConsumerId) {
+ this.targetConsumerId = targetConsumerId;
+ }
+
+ public boolean isExpired() {
+ long expireTime = getExpiration();
+ return expireTime > 0 && System.currentTimeMillis() > expireTime;
+ }
+
+ public boolean isAdvisory() {
+ return type != null && type.equals(ADIVSORY_MESSAGE_TYPE);
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean isCompressed() {
+ return compressed;
+ }
+
+ public void setCompressed(boolean compressed) {
+ this.compressed = compressed;
+ }
+
+ public boolean isRedelivered() {
+ return redeliveryCounter > 0;
+ }
+
+ public void setRedelivered(boolean redelivered) {
+ if (redelivered) {
+ if (!isRedelivered()) {
+ setRedeliveryCounter(1);
+ }
+ } else {
+ if (isRedelivered()) {
+ setRedeliveryCounter(0);
+ }
+ }
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public int getRedeliveryCounter() {
+ return redeliveryCounter;
+ }
+
+ public void setRedeliveryCounter(int deliveryCounter) {
+ this.redeliveryCounter = deliveryCounter;
+ }
+
+ /**
+ * The route of brokers the command has moved through.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId[] getBrokerPath() {
+ return brokerPath;
+ }
+
+ public void setBrokerPath(BrokerId[] brokerPath) {
+ this.brokerPath = brokerPath;
+ }
+
+ /**
+ * Used to schedule the arrival time of a message to a broker. The broker
+ * will not dispatch a message to a consumer until it's arrival time has
+ * elapsed.
+ *
+ * @openwire:property version=1
+ */
+ public long getArrival() {
+ return arrival;
+ }
+
+ public void setArrival(long arrival) {
+ this.arrival = arrival;
+ }
+
+ /**
+ * Only set by the broker and defines the userID of the producer connection
+ * who sent this message. This is an optional field, it needs to be enabled
+ * on the broker to have this field populated.
+ *
+ * @openwire:property version=1
+ */
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String jmsxUserId) {
+ this.userId = jmsxUserId;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return true;
+ }
+
+ public int getSize() {
+ int minimumMessageSize = DEFAULT_MINIMUM_MESSAGE_SIZE;
+ if (size < minimumMessageSize || size == 0) {
+ size = minimumMessageSize;
+ if (marshalledProperties != null) {
+ size += marshalledProperties.getLength();
+ }
+ if (content != null) {
+ size += content.getLength();
+ }
+ }
+ return size;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the recievedByDFBridge.
+ */
+ public boolean isRecievedByDFBridge() {
+ return recievedByDFBridge;
+ }
+
+ /**
+ * @param recievedByDFBridge The recievedByDFBridge to set.
+ */
+ public void setRecievedByDFBridge(boolean recievedByDFBridge) {
+ this.recievedByDFBridge = recievedByDFBridge;
+ }
+
+ /**
+ * @openwire:property version=2 cache=true
+ */
+ public boolean isDroppable() {
+ return droppable;
+ }
+
+ public void setDroppable(boolean droppable) {
+ this.droppable = droppable;
+ }
+
+ /**
+ * If a message is stored in multiple nodes on a cluster, all the cluster
+ * members will be listed here. Otherwise, it will be null.
+ *
+ * @openwire:property version=3 cache=true
+ */
+ public BrokerId[] getCluster() {
+ return cluster;
+ }
+
+ public void setCluster(BrokerId[] cluster) {
+ this.cluster = cluster;
+ }
+
+ @Override
+ public boolean isMessage() {
+ return true;
+ }
+
+ /**
+ * @openwire:property version=3
+ */
+ public long getBrokerInTime() {
+ return this.brokerInTime;
+ }
+
+ public void setBrokerInTime(long brokerInTime) {
+ this.brokerInTime = brokerInTime;
+ }
+
+ /**
+ * @openwire:property version=3
+ */
+ public long getBrokerOutTime() {
+ return this.brokerOutTime;
+ }
+
+ public void setBrokerOutTime(long brokerOutTime) {
+ this.brokerOutTime = brokerOutTime;
+ }
+
+ /**
+ * @openwire:property version=10
+ */
+ public boolean isJMSXGroupFirstForConsumer() {
+ return jmsXGroupFirstForConsumer;
+ }
+
+ public void setJMSXGroupFirstForConsumer(boolean val) {
+ jmsXGroupFirstForConsumer = val;
+ }
+
+ /**
+ * For a Message that is not currently using compression in its message body this
+ * method will initiate a store of current content and then compress the data in
+ * the message body.
+ *
+ * @throws IOException if an error occurs during the compression process.
+ */
+ public void compress() throws IOException {
+ if (!isCompressed()) {
+ storeContent();
+ if (!isCompressed() && getContent() != null) {
+ doCompress();
+ }
+ }
+ }
+
+ /**
+ * For a message whose body is compressed this method will perform a full decompression
+ * of the contents and return the resulting uncompressed buffer, if the contents are not
+ * compressed then they are returned unchanged.
+ *
+ * @return a Buffer instance that contains the message contents, uncompressed if needed.
+ *
+ * @throws IOException if an error occurs during decompression of the message contents.
+ */
+ public Buffer decompress() throws IOException {
+ if (isCompressed()) {
+ return doDecompress();
+ } else {
+ return content;
+ }
+ }
+
+ protected Buffer doDecompress() throws IOException {
+ ByteArrayInputStream input = new ByteArrayInputStream(this.content.getData(), this.content.getOffset(), this.content.getLength());
+ InflaterInputStream inflater = new InflaterInputStream(input);
+
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try {
+ byte[] buffer = new byte[8*1024];
+ int read = 0;
+ while ((read = inflater.read(buffer)) != -1) {
+ output.write(buffer, 0, read);
+ }
+ } finally {
+ inflater.close();
+ output.close();
+ }
+
+ return output.toBuffer();
+ }
+
+ protected void doCompress() throws IOException {
+ compressed = true;
+ Buffer bytes = getContent();
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ OutputStream os = new DeflaterOutputStream(bytesOut);
+ os.write(bytes.data, bytes.offset, bytes.length);
+ os.close();
+ setContent(bytesOut.toBuffer());
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " { " + messageId + " }";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageAck.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageAck.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageAck.java
new file mode 100644
index 0000000..783b048
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageAck.java
@@ -0,0 +1,254 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="22"
+ */
+public class MessageAck extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_ACK;
+
+ /**
+ * Used to let the broker know that the message has been delivered to the client. Message
+ * will still be retained until an standard ack is received. This is used get the broker to
+ * send more messages past prefetch limits when an standard ack has not been sent.
+ */
+ public static final byte DELIVERED_ACK_TYPE = 0;
+
+ /**
+ * The standard ack case where a client wants the message to be discarded.
+ */
+ public static final byte STANDARD_ACK_TYPE = 2;
+
+ /**
+ * In case the client want's to explicitly let the broker know that a message was not
+ * processed and the message was considered a poison message.
+ */
+ public static final byte POSION_ACK_TYPE = 1;
+
+ /**
+ * In case the client want's to explicitly let the broker know that a message was not
+ * processed and it was re-delivered to the consumer but it was not yet considered to be a
+ * poison message. The messageCount field will hold the number of times the message was
+ * re-delivered.
+ */
+ public static final byte REDELIVERED_ACK_TYPE = 3;
+
+ /**
+ * The ack case where a client wants only an individual message to be discarded.
+ */
+ public static final byte INDIVIDUAL_ACK_TYPE = 4;
+
+ /**
+ * The ack case where a durable topic subscription does not match a selector.
+ */
+ public static final byte UNMATCHED_ACK_TYPE = 5;
+
+ /**
+ * the case where a consumer does not dispatch because message has expired inflight
+ */
+ public static final byte EXPIRED_ACK_TYPE = 6;
+
+ protected byte ackType;
+ protected ConsumerId consumerId;
+ protected MessageId firstMessageId;
+ protected MessageId lastMessageId;
+ protected OpenWireDestination destination;
+ protected TransactionId transactionId;
+ protected int messageCount;
+ protected Throwable poisonCause;
+
+ protected transient String consumerKey;
+
+ public MessageAck() {
+ }
+
+ public MessageAck(MessageDispatch md, byte ackType, int messageCount) {
+ this.ackType = ackType;
+ this.consumerId = md.getConsumerId();
+ this.destination = md.getDestination();
+ this.lastMessageId = md.getMessage().getMessageId();
+ this.messageCount = messageCount;
+ }
+
+ public MessageAck(Message message, byte ackType, int messageCount) {
+ this.ackType = ackType;
+ this.destination = message.getDestination();
+ this.lastMessageId = message.getMessageId();
+ this.messageCount = messageCount;
+ }
+
+ public void copy(MessageAck copy) {
+ super.copy(copy);
+ copy.firstMessageId = firstMessageId;
+ copy.lastMessageId = lastMessageId;
+ copy.destination = destination;
+ copy.transactionId = transactionId;
+ copy.ackType = ackType;
+ copy.consumerId = consumerId;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isMessageAck() {
+ return true;
+ }
+
+ public boolean isPoisonAck() {
+ return ackType == POSION_ACK_TYPE;
+ }
+
+ public boolean isStandardAck() {
+ return ackType == STANDARD_ACK_TYPE;
+ }
+
+ public boolean isDeliveredAck() {
+ return ackType == DELIVERED_ACK_TYPE;
+ }
+
+ public boolean isRedeliveredAck() {
+ return ackType == REDELIVERED_ACK_TYPE;
+ }
+
+ public boolean isIndividualAck() {
+ return ackType == INDIVIDUAL_ACK_TYPE;
+ }
+
+ public boolean isUnmatchedAck() {
+ return ackType == UNMATCHED_ACK_TYPE;
+ }
+
+ public boolean isExpiredAck() {
+ return ackType == EXPIRED_ACK_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public TransactionId getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(TransactionId transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public boolean isInTransaction() {
+ return transactionId != null;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConsumerId getConsumerId() {
+ return consumerId;
+ }
+
+ public void setConsumerId(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public byte getAckType() {
+ return ackType;
+ }
+
+ public void setAckType(byte ackType) {
+ this.ackType = ackType;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public MessageId getFirstMessageId() {
+ return firstMessageId;
+ }
+
+ public void setFirstMessageId(MessageId firstMessageId) {
+ this.firstMessageId = firstMessageId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public MessageId getLastMessageId() {
+ return lastMessageId;
+ }
+
+ public void setLastMessageId(MessageId lastMessageId) {
+ this.lastMessageId = lastMessageId;
+ }
+
+ /**
+ * The number of messages being acknowledged in the range.
+ *
+ * @openwire:property version=1
+ */
+ public int getMessageCount() {
+ return messageCount;
+ }
+
+ public void setMessageCount(int messageCount) {
+ this.messageCount = messageCount;
+ }
+
+ /**
+ * The cause of a poison ack, if a message listener throws an exception it will be recorded
+ * here
+ *
+ * @openwire:property version=7
+ */
+ public Throwable getPoisonCause() {
+ return poisonCause;
+ }
+
+ public void setPoisonCause(Throwable poisonCause) {
+ this.poisonCause = poisonCause;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processMessageAck(this);
+ }
+
+ /**
+ * A helper method to allow a single message ID to be acknowledged
+ */
+ public void setMessageID(MessageId messageID) {
+ setFirstMessageId(messageID);
+ setLastMessageId(messageID);
+ setMessageCount(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatch.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatch.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatch.java
new file mode 100644
index 0000000..6dfe04d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatch.java
@@ -0,0 +1,89 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="21"
+ */
+public class MessageDispatch extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_DISPATCH;
+
+ protected ConsumerId consumerId;
+ protected OpenWireDestination destination;
+ protected Message message;
+ protected int redeliveryCounter;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isMessageDispatch() {
+ return true;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConsumerId getConsumerId() {
+ return consumerId;
+ }
+
+ public void setConsumerId(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public Message getMessage() {
+ return message;
+ }
+
+ public void setMessage(Message message) {
+ this.message = message;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public int getRedeliveryCounter() {
+ return redeliveryCounter;
+ }
+
+ public void setRedeliveryCounter(int deliveryCounter) {
+ this.redeliveryCounter = deliveryCounter;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processMessageDispatch(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatchNotification.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatchNotification.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatchNotification.java
new file mode 100644
index 0000000..91ae1aa
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageDispatchNotification.java
@@ -0,0 +1,89 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="90"
+ */
+public class MessageDispatchNotification extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_DISPATCH_NOTIFICATION;
+
+ protected ConsumerId consumerId;
+ protected OpenWireDestination destination;
+ protected MessageId messageId;
+ protected long deliverySequenceId;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isMessageDispatchNotification() {
+ return true;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConsumerId getConsumerId() {
+ return consumerId;
+ }
+
+ public void setConsumerId(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getDeliverySequenceId() {
+ return deliverySequenceId;
+ }
+
+ public void setDeliverySequenceId(long deliverySequenceId) {
+ this.deliverySequenceId = deliverySequenceId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public MessageId getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(MessageId messageId) {
+ this.messageId = messageId;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processMessageDispatchNotification(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageId.java
new file mode 100644
index 0000000..4f3b13e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessageId.java
@@ -0,0 +1,202 @@
+/**
+ * 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.commands;
+
+
+/**
+ * @openwire:marshaller code="110"
+ */
+public class MessageId implements DataStructure, Comparable<MessageId> {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_ID;
+
+ protected String textView;
+ protected ProducerId producerId;
+ protected long producerSequenceId;
+ protected long brokerSequenceId;
+
+ private transient String key;
+ private transient int hashCode;
+
+ public MessageId() {
+ this.producerId = new ProducerId();
+ }
+
+ public MessageId(ProducerInfo producerInfo, long producerSequenceId) {
+ this.producerId = producerInfo.getProducerId();
+ this.producerSequenceId = producerSequenceId;
+ }
+
+ public MessageId(String messageKey) {
+ setValue(messageKey);
+ }
+
+ public MessageId(String producerId, long producerSequenceId) {
+ this(new ProducerId(producerId), producerSequenceId);
+ }
+
+ public MessageId(ProducerId producerId, long producerSequenceId) {
+ this.producerId = producerId;
+ this.producerSequenceId = producerSequenceId;
+ }
+
+ /**
+ * Sets the value as a String
+ */
+ public void setValue(String messageKey) {
+ key = messageKey;
+ // Parse off the sequenceId
+ int p = messageKey.lastIndexOf(":");
+ if (p >= 0) {
+ producerSequenceId = Long.parseLong(messageKey.substring(p + 1));
+ messageKey = messageKey.substring(0, p);
+ } else {
+ throw new NumberFormatException();
+ }
+ producerId = new ProducerId(messageKey);
+ }
+
+ /**
+ * Sets the transient text view of the message which will be ignored if the message is marshaled on a transport; so
+ * is only for in-JVM changes to accommodate foreign JMS message IDs
+ */
+ public void setTextView(String key) {
+ this.textView = key;
+ }
+
+ /**
+ * @openwire:property version=10
+ * @return
+ */
+ public String getTextView() {
+ return textView;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != getClass()) {
+ return false;
+ }
+
+ MessageId id = (MessageId) o;
+ return producerSequenceId == id.producerSequenceId && producerId.equals(id.producerId);
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ if (textView != null) {
+ hashCode = textView.hashCode();
+ } else {
+ hashCode = producerId.hashCode() ^ (int) producerSequenceId;
+ }
+ }
+ return hashCode;
+ }
+
+ public String toProducerKey() {
+ if (textView == null) {
+ return toString();
+ } else {
+ return producerId.toString() + ":" + producerSequenceId;
+ }
+ }
+
+ @Override
+ public String toString() {
+ if (key == null) {
+ if (textView != null) {
+ if (textView.startsWith("ID:")) {
+ key = textView;
+ } else {
+ key = "ID:" + textView;
+ }
+ } else {
+ key = producerId.toString() + ":" + producerSequenceId;
+ }
+ }
+ return key;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ProducerId getProducerId() {
+ return producerId;
+ }
+
+ public void setProducerId(ProducerId producerId) {
+ this.producerId = producerId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getProducerSequenceId() {
+ return producerSequenceId;
+ }
+
+ public void setProducerSequenceId(long producerSequenceId) {
+ this.producerSequenceId = producerSequenceId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getBrokerSequenceId() {
+ return brokerSequenceId;
+ }
+
+ public void setBrokerSequenceId(long brokerSequenceId) {
+ this.brokerSequenceId = brokerSequenceId;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ public MessageId copy() {
+ MessageId copy = new MessageId(producerId, producerSequenceId);
+ copy.key = key;
+ copy.brokerSequenceId = brokerSequenceId;
+ copy.textView = textView;
+ return copy;
+ }
+
+ /**
+ * @param
+ * @return
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(MessageId other) {
+ int result = -1;
+ if (other != null) {
+ result = this.toString().compareTo(other.toString());
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessagePull.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessagePull.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessagePull.java
new file mode 100644
index 0000000..29f5c01
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/MessagePull.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.commands;
+
+/**
+ * Used to pull messages on demand, the command can have a time value that indicates
+ * how long the Broker keeps the pull request open before returning a MessageDispatch
+ * with a null payload.
+ *
+ * @openwire:marshaller code="20"
+ */
+public class MessagePull extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.MESSAGE_PULL;
+
+ protected ConsumerId consumerId;
+ protected OpenWireDestination destination;
+ protected long timeout;
+ private MessageId messageId;
+ private String correlationId;
+
+ private transient boolean tracked = false;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processMessagePull(this);
+ }
+
+ /**
+ * Configures a message pull from the consumer information
+ */
+ public void configure(ConsumerInfo info) {
+ setConsumerId(info.getConsumerId());
+ setDestination(info.getDestination());
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConsumerId getConsumerId() {
+ return consumerId;
+ }
+
+ public void setConsumerId(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ /**
+ * An optional correlation ID which could be used by a broker to decide which messages are pulled
+ * on demand from a queue for a consumer
+ *
+ * @openwire:property version=3
+ */
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public void setCorrelationId(String correlationId) {
+ this.correlationId = correlationId;
+ }
+
+ /**
+ * An optional message ID which could be used by a broker to decide which messages are pulled
+ * on demand from a queue for a consumer
+ *
+ * @openwire:property version=3
+ */
+ public MessageId getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(MessageId messageId) {
+ this.messageId = messageId;
+ }
+
+ public void setTracked(boolean tracked) {
+ this.tracked = tracked;
+ }
+
+ public boolean isTracked() {
+ return this.tracked;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/NetworkBridgeFilter.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/NetworkBridgeFilter.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/NetworkBridgeFilter.java
new file mode 100644
index 0000000..f39286a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/NetworkBridgeFilter.java
@@ -0,0 +1,96 @@
+/**
+ * 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.commands;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @openwire:marshaller code="91"
+ */
+public class NetworkBridgeFilter implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.NETWORK_BRIDGE_FILTER;
+
+ static final Logger LOG = LoggerFactory.getLogger(NetworkBridgeFilter.class);
+
+ protected BrokerId networkBrokerId;
+ protected int messageTTL;
+ protected int consumerTTL;
+
+ public NetworkBridgeFilter() {
+ }
+
+ public NetworkBridgeFilter(ConsumerInfo consumerInfo, BrokerId networkBrokerId, int messageTTL, int consumerTTL) {
+ this.networkBrokerId = networkBrokerId;
+ this.messageTTL = messageTTL;
+ this.consumerTTL = consumerTTL;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ // keep for backward compat with older wire formats
+ public int getNetworkTTL() {
+ return messageTTL;
+ }
+
+ public void setNetworkTTL(int networkTTL) {
+ messageTTL = networkTTL;
+ consumerTTL = networkTTL;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId getNetworkBrokerId() {
+ return networkBrokerId;
+ }
+
+ public void setNetworkBrokerId(BrokerId remoteBrokerPath) {
+ this.networkBrokerId = remoteBrokerPath;
+ }
+
+ public void setMessageTTL(int messageTTL) {
+ this.messageTTL = messageTTL;
+ }
+
+ /**
+ * @openwire:property version=10
+ */
+ public int getMessageTTL() {
+ return this.messageTTL;
+ }
+
+ public void setConsumerTTL(int consumerTTL) {
+ this.consumerTTL = consumerTTL;
+ }
+
+ /**
+ * @openwire:property version=10
+ */
+ public int getConsumerTTL() {
+ return this.consumerTTL;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBlobMessage.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBlobMessage.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBlobMessage.java
new file mode 100644
index 0000000..1c3f191
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireBlobMessage.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.commands;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.jms.JMSException;
+
+/**
+ * An implementation of ActiveMQ's BlobMessage for out of band BLOB transfer
+ *
+ * openwire:marshaller code="29"
+ */
+public class OpenWireBlobMessage extends OpenWireMessage {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_BLOB_MESSAGE;
+
+ public static final String BINARY_MIME_TYPE = "application/octet-stream";
+
+ private String remoteBlobUrl;
+ private String mimeType;
+ private String name;
+ private boolean deletedByBroker;
+
+ private transient URL url;
+
+ @Override
+ public OpenWireBlobMessage copy() {
+ OpenWireBlobMessage copy = new OpenWireBlobMessage();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(OpenWireBlobMessage copy) {
+ super.copy(copy);
+ copy.setRemoteBlobUrl(getRemoteBlobUrl());
+ copy.setMimeType(getMimeType());
+ copy.setDeletedByBroker(isDeletedByBroker());
+ copy.setName(getName());
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=3 cache=false
+ */
+ public String getRemoteBlobUrl() {
+ return remoteBlobUrl;
+ }
+
+ public void setRemoteBlobUrl(String remoteBlobUrl) {
+ this.remoteBlobUrl = remoteBlobUrl;
+ url = null;
+ }
+
+ /**
+ * The MIME type of the BLOB which can be used to apply different content types to messages.
+ *
+ * @openwire:property version=3 cache=true
+ */
+ @Override
+ public String getMimeType() {
+ if (mimeType == null) {
+ return BINARY_MIME_TYPE;
+ }
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * The name of the attachment which can be useful information if transmitting files over
+ * ActiveMQ
+ *
+ * @openwire:property version=3 cache=false
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @openwire:property version=3 cache=false
+ */
+ public boolean isDeletedByBroker() {
+ return deletedByBroker;
+ }
+
+ public void setDeletedByBroker(boolean deletedByBroker) {
+ this.deletedByBroker = deletedByBroker;
+ }
+
+ public InputStream getInputStream() throws IOException, JMSException {
+ return null;
+ }
+
+ public URL getURL() throws JMSException {
+ if (url == null && remoteBlobUrl != null) {
+ try {
+ url = new URL(remoteBlobUrl);
+ } catch (MalformedURLException e) {
+ throw new JMSException(e.getMessage());
+ }
+ }
+ return url;
+ }
+
+ public void setURL(URL url) {
+ this.url = url;
+ remoteBlobUrl = url != null ? url.toExternalForm() : null;
+ }
+
+ @Override
+ public void onSend() throws JMSException {
+ super.onSend();
+
+ // lets ensure we upload the BLOB first out of band before we send the
+ // message
+ // TODO - Lets support this later.
+ }
+
+ public void deleteFile() throws IOException, JMSException {
+ }
+}
[27/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessageTest.java b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessageTest.java
new file mode 100644
index 0000000..fe4cc9d
--- /dev/null
+++ b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessageTest.java
@@ -0,0 +1,938 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.jms.OpenWireJMSStreamMessage;
+import org.junit.Test;
+
+/**
+ * Test for the OpenWireJMSStreamMessage facade class.
+ */
+public class OpenWireJMSStreamMessageTest {
+
+ @Test
+ public void testReadBoolean() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ msg.writeBoolean(true);
+ msg.reset();
+ assertTrue(msg.readBoolean());
+ msg.reset();
+ assertTrue(msg.readString().equals("true"));
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testreadByte() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ byte test = (byte) 4;
+ msg.writeByte(test);
+ msg.reset();
+ assertTrue(msg.readByte() == test);
+ msg.reset();
+ assertTrue(msg.readShort() == test);
+ msg.reset();
+ assertTrue(msg.readInt() == test);
+ msg.reset();
+ assertTrue(msg.readLong() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(new Byte(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testReadShort() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ short test = (short) 4;
+ msg.writeShort(test);
+ msg.reset();
+ assertTrue(msg.readShort() == test);
+ msg.reset();
+ assertTrue(msg.readInt() == test);
+ msg.reset();
+ assertTrue(msg.readLong() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(new Short(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testReadChar() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ char test = 'z';
+ msg.writeChar(test);
+ msg.reset();
+ assertTrue(msg.readChar() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(new Character(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testReadInt() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ int test = 4;
+ msg.writeInt(test);
+ msg.reset();
+ assertTrue(msg.readInt() == test);
+ msg.reset();
+ assertTrue(msg.readLong() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(new Integer(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testReadLong() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ long test = 4L;
+ msg.writeLong(test);
+ msg.reset();
+ assertTrue(msg.readLong() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(Long.valueOf(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg = new OpenWireJMSStreamMessage();
+ msg.writeObject(new Long("1"));
+ // reset so it's readable now
+ msg.reset();
+ assertEquals(new Long("1"), msg.readObject());
+ }
+
+ @Test
+ public void testReadFloat() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ float test = 4.4f;
+ msg.writeFloat(test);
+ msg.reset();
+ assertTrue(msg.readFloat() == test);
+ msg.reset();
+ assertTrue(msg.readDouble() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(new Float(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testReadDouble() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ double test = 4.4d;
+ msg.writeDouble(test);
+ msg.reset();
+ assertTrue(msg.readDouble() == test);
+ msg.reset();
+ assertTrue(msg.readString().equals(new Double(test).toString()));
+ msg.reset();
+ try {
+ msg.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testReadString() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ byte testByte = (byte) 2;
+ msg.writeString(new Byte(testByte).toString());
+ msg.reset();
+ assertTrue(msg.readByte() == testByte);
+ msg.clearBody();
+ short testShort = 3;
+ msg.writeString(new Short(testShort).toString());
+ msg.reset();
+ assertTrue(msg.readShort() == testShort);
+ msg.clearBody();
+ int testInt = 4;
+ msg.writeString(new Integer(testInt).toString());
+ msg.reset();
+ assertTrue(msg.readInt() == testInt);
+ msg.clearBody();
+ long testLong = 6L;
+ msg.writeString(new Long(testLong).toString());
+ msg.reset();
+ assertTrue(msg.readLong() == testLong);
+ msg.clearBody();
+ float testFloat = 6.6f;
+ msg.writeString(new Float(testFloat).toString());
+ msg.reset();
+ assertTrue(msg.readFloat() == testFloat);
+ msg.clearBody();
+ double testDouble = 7.7d;
+ msg.writeString(new Double(testDouble).toString());
+ msg.reset();
+ assertTrue(msg.readDouble() == testDouble);
+ msg.clearBody();
+ msg.writeString("true");
+ msg.reset();
+ assertTrue(msg.readBoolean());
+ msg.clearBody();
+ msg.writeString("a");
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ msg.clearBody();
+ msg.writeString("777");
+ msg.reset();
+ try {
+ msg.readBytes(new byte[3]);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testReadBigString() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ try {
+ // Test with a 1Meg String
+ StringBuffer bigSB = new StringBuffer(1024 * 1024);
+ for (int i = 0; i < 1024 * 1024; i++) {
+ bigSB.append('a' + i % 26);
+ }
+ String bigString = bigSB.toString();
+
+ msg.writeString(bigString);
+ msg.reset();
+ assertEquals(bigString, msg.readString());
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadBytes() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ try {
+ byte[] test = new byte[50];
+ for (int i = 0; i < test.length; i++) {
+ test[i] = (byte) i;
+ }
+ msg.writeBytes(test);
+ msg.reset();
+ byte[] valid = new byte[test.length];
+ msg.readBytes(valid);
+ for (int i = 0; i < valid.length; i++) {
+ assertTrue(valid[i] == test[i]);
+ }
+ msg.reset();
+ try {
+ msg.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ msg.reset();
+ try {
+ msg.readString();
+ fail("Should have thrown exception");
+ } catch (MessageFormatException mfe) {
+ }
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadObject() throws Exception {
+ OpenWireJMSStreamMessage msg = new OpenWireJMSStreamMessage();
+ try {
+ byte testByte = (byte) 2;
+ msg.writeByte(testByte);
+ msg.reset();
+ assertTrue(((Byte) msg.readObject()).byteValue() == testByte);
+ msg.clearBody();
+
+ short testShort = 3;
+ msg.writeShort(testShort);
+ msg.reset();
+ assertTrue(((Short) msg.readObject()).shortValue() == testShort);
+ msg.clearBody();
+
+ int testInt = 4;
+ msg.writeInt(testInt);
+ msg.reset();
+ assertTrue(((Integer) msg.readObject()).intValue() == testInt);
+ msg.clearBody();
+
+ long testLong = 6L;
+ msg.writeLong(testLong);
+ msg.reset();
+ assertTrue(((Long) msg.readObject()).longValue() == testLong);
+ msg.clearBody();
+
+ float testFloat = 6.6f;
+ msg.writeFloat(testFloat);
+ msg.reset();
+ assertTrue(((Float) msg.readObject()).floatValue() == testFloat);
+ msg.clearBody();
+
+ double testDouble = 7.7d;
+ msg.writeDouble(testDouble);
+ msg.reset();
+ assertTrue(((Double) msg.readObject()).doubleValue() == testDouble);
+ msg.clearBody();
+
+ char testChar = 'z';
+ msg.writeChar(testChar);
+ msg.reset();
+ assertTrue(((Character) msg.readObject()).charValue() == testChar);
+ msg.clearBody();
+
+ byte[] data = new byte[50];
+ for (int i = 0; i < data.length; i++) {
+ data[i] = (byte) i;
+ }
+ msg.writeBytes(data);
+ msg.reset();
+ byte[] valid = (byte[]) msg.readObject();
+ assertTrue(valid.length == data.length);
+ for (int i = 0; i < valid.length; i++) {
+ assertTrue(valid[i] == data[i]);
+ }
+ msg.clearBody();
+ msg.writeBoolean(true);
+ msg.reset();
+ assertTrue(((Boolean) msg.readObject()).booleanValue());
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireJMSStreamMessage streamMessage = new OpenWireJMSStreamMessage();
+ try {
+ streamMessage.writeObject(new Long(2));
+ streamMessage.clearBody();
+ assertFalse(streamMessage.isReadOnlyBody());
+ streamMessage.writeObject(new Long(2));
+ streamMessage.readObject();
+ fail("should throw exception");
+ } catch (MessageNotReadableException mnwe) {
+ } catch (MessageNotWriteableException mnwe) {
+ fail("should be writeable");
+ }
+ }
+
+ @Test
+ public void testReset() throws JMSException {
+ OpenWireJMSStreamMessage streamMessage = new OpenWireJMSStreamMessage();
+ try {
+ streamMessage.writeDouble(24.5);
+ streamMessage.writeLong(311);
+ } catch (MessageNotWriteableException mnwe) {
+ fail("should be writeable");
+ }
+ streamMessage.reset();
+ try {
+ assertTrue(streamMessage.isReadOnlyBody());
+ assertEquals(streamMessage.readDouble(), 24.5, 0);
+ assertEquals(streamMessage.readLong(), 311);
+ } catch (MessageNotReadableException mnre) {
+ fail("should be readable");
+ }
+ try {
+ streamMessage.writeInt(33);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testReadOnlyBody() throws JMSException {
+ OpenWireJMSStreamMessage message = new OpenWireJMSStreamMessage();
+ try {
+ message.writeBoolean(true);
+ message.writeByte((byte) 1);
+ message.writeBytes(new byte[1]);
+ message.writeBytes(new byte[3], 0, 2);
+ message.writeChar('a');
+ message.writeDouble(1.5);
+ message.writeFloat((float) 1.5);
+ message.writeInt(1);
+ message.writeLong(1);
+ message.writeObject("stringobj");
+ message.writeShort((short) 1);
+ message.writeString("string");
+ } catch (MessageNotWriteableException mnwe) {
+ fail("Should be writeable");
+ }
+ message.reset();
+ try {
+ message.readBoolean();
+ message.readByte();
+ assertEquals(1, message.readBytes(new byte[10]));
+ assertEquals(-1, message.readBytes(new byte[10]));
+ assertEquals(2, message.readBytes(new byte[10]));
+ assertEquals(-1, message.readBytes(new byte[10]));
+ message.readChar();
+ message.readDouble();
+ message.readFloat();
+ message.readInt();
+ message.readLong();
+ message.readString();
+ message.readShort();
+ message.readString();
+ } catch (MessageNotReadableException mnwe) {
+ fail("Should be readable");
+ }
+ try {
+ message.writeBoolean(true);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeByte((byte) 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeBytes(new byte[3], 0, 2);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeChar('a');
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeDouble(1.5);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeFloat((float) 1.5);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeInt(1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeLong(1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeObject("stringobj");
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeShort((short) 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeString("string");
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testWriteOnlyBody() throws JMSException {
+ OpenWireJMSStreamMessage message = new OpenWireJMSStreamMessage();
+ message.clearBody();
+ try {
+ message.writeBoolean(true);
+ message.writeByte((byte) 1);
+ message.writeBytes(new byte[1]);
+ message.writeBytes(new byte[3], 0, 2);
+ message.writeChar('a');
+ message.writeDouble(1.5);
+ message.writeFloat((float) 1.5);
+ message.writeInt(1);
+ message.writeLong(1);
+ message.writeObject("stringobj");
+ message.writeShort((short) 1);
+ message.writeString("string");
+ } catch (MessageNotWriteableException mnwe) {
+ fail("Should be writeable");
+ }
+ try {
+ message.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException mnwe) {
+ }
+ try {
+ message.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readBytes(new byte[2]);
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readString();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readString();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ }
+
+ @Test
+ public void testWriteObject() throws Exception {
+ try {
+ OpenWireJMSStreamMessage message = new OpenWireJMSStreamMessage();
+ message.clearBody();
+ message.writeObject("test");
+ message.writeObject(new Character('a'));
+ message.writeObject(new Boolean(false));
+ message.writeObject(new Byte((byte) 2));
+ message.writeObject(new Short((short) 2));
+ message.writeObject(new Integer(2));
+ message.writeObject(new Long(2l));
+ message.writeObject(new Float(2.0f));
+ message.writeObject(new Double(2.0d));
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ try {
+ OpenWireJMSStreamMessage message = new OpenWireJMSStreamMessage();
+ message.clearBody();
+ message.writeObject(new Object());
+ fail("should throw an exception");
+ } catch (MessageFormatException e) {
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessageTest.java b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessageTest.java
new file mode 100644
index 0000000..c299f8c
--- /dev/null
+++ b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessageTest.java
@@ -0,0 +1,97 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.DataOutputStream;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+import org.apache.activemq.openwire.jms.OpenWireJMSTextMessage;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class OpenWireJMSTextMessageTest {
+
+ @Test
+ public void testReadOnlyBody() throws JMSException {
+ OpenWireJMSTextMessage textMessage = new OpenWireJMSTextMessage();
+ textMessage.setText("test");
+ textMessage.setReadOnlyBody(true);
+ try {
+ textMessage.getText();
+ } catch (MessageNotReadableException e) {
+ fail("should be readable");
+ }
+ try {
+ textMessage.setText("test");
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testWriteOnlyBody() throws JMSException { // should always be readable
+ OpenWireJMSTextMessage textMessage = new OpenWireJMSTextMessage();
+ textMessage.setReadOnlyBody(false);
+ try {
+ textMessage.setText("test");
+ textMessage.getText();
+ } catch (MessageNotReadableException e) {
+ fail("should be readable");
+ }
+ textMessage.setReadOnlyBody(true);
+ try {
+ textMessage.getText();
+ textMessage.setText("test");
+ fail("should throw exception");
+ } catch (MessageNotReadableException e) {
+ fail("should be readable");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testShortText() throws Exception {
+ String shortText = "Content";
+ OpenWireJMSTextMessage shortMessage = new OpenWireJMSTextMessage();
+ setContent(shortMessage.getOpenWireMessage(), shortText);
+ assertTrue(shortMessage.getText().equals(shortText));
+
+ String longText = "Very very very very veeeeeeery loooooooooooooooooooooooooooooooooong text";
+ OpenWireJMSTextMessage longMessage = new OpenWireJMSTextMessage();
+ setContent(longMessage.getOpenWireMessage(), longText);
+ assertTrue(longMessage.getText().equals(longText));
+ }
+
+ protected void setContent(OpenWireMessage message, String text) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(baos);
+ OpenWireMarshallingSupport.writeUTF8(dataOut, text);
+ dataOut.close();
+ message.setContent(baos.toBuffer());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/resources/log4j.properties b/openwire-jms/src/test/resources/log4j.properties
new file mode 100644
index 0000000..0588275
--- /dev/null
+++ b/openwire-jms/src/test/resources/log4j.properties
@@ -0,0 +1,41 @@
+## ---------------------------------------------------------------------------
+## 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
+
+# Tune the ActiveMQ and it's OpenWire transport as needed for debugging.
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.broker=DEBUG
+log4j.logger.org.apache.activemq.transport.openwire=TRACE
+log4j.logger.org.apache.activemq.transport.openwire.FRAMES=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/7ae454fa/openwire-legacy/.gitignore
----------------------------------------------------------------------
diff --git a/openwire-legacy/.gitignore b/openwire-legacy/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/openwire-legacy/.gitignore
@@ -0,0 +1 @@
+/target
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-legacy/pom.xml b/openwire-legacy/pom.xml
new file mode 100644
index 0000000..8d61ac9
--- /dev/null
+++ b/openwire-legacy/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-protocol</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openwire-legacy</artifactId>
+ <name>openwire-legacy</name>
+ <description>An OpenWire extension library that contains the legacy OpenWire Codecs</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <!-- =================================== -->
+ <!-- Required Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <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>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BaseCommandMarshaller.java
new file mode 100644
index 0000000..bf85755
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/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.v2;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerIdMarshaller.java
new file mode 100644
index 0000000..4d865c6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerIdMarshaller.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.v2;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..2e4fcb5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/BrokerInfoMarshaller.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.v2;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(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 {
+ 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..b100047
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionControlMarshaller.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.v2;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..15286a3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/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.v2;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..ff430d1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/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.v2;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..154c123
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConnectionInfoMarshaller.java
@@ -0,0 +1,174 @@
+/**
+ * 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.v2;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(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());
+ bs.writeBoolean(info.isClientMaster());
+
+ 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();
+ 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((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(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());
+ dataOut.writeBoolean(info.isClientMaster());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..51fa18f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
[46/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..75ecc5a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoMarshaller.java
@@ -0,0 +1,150 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/XATransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..4b4c988
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/XATransactionIdMarshaller.java
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BaseCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BaseCommandMarshaller.java
new file mode 100644
index 0000000..75130d2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/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.v10;
+
+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/v10/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerIdMarshaller.java
new file mode 100644
index 0000000..d84a7c5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerIdMarshaller.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.v10;
+
+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/v10/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..52196fa
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v10;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionControlMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..381c0dd
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionControlMarshaller.java
@@ -0,0 +1,163 @@
+/**
+ * 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.v10;
+
+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());
+ info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
+ info.setReconnectTo(tightUnmarshalString(dataIn, bs));
+ info.setRebalanceConnection(bs.readBoolean());
+ info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * 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());
+ rc += tightMarshalString1(info.getConnectedBrokers(), bs);
+ rc += tightMarshalString1(info.getReconnectTo(), bs);
+ bs.writeBoolean(info.isRebalanceConnection());
+ rc += tightMarshalByteArray1(info.getToken(), 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getConnectedBrokers(), dataOut, bs);
+ tightMarshalString2(info.getReconnectTo(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalByteArray2(info.getToken(), 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setExit(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setResume(dataIn.readBoolean());
+ info.setSuspend(dataIn.readBoolean());
+ info.setConnectedBrokers(looseUnmarshalString(dataIn));
+ info.setReconnectTo(looseUnmarshalString(dataIn));
+ info.setRebalanceConnection(dataIn.readBoolean());
+ info.setToken(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * 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());
+ looseMarshalString(info.getConnectedBrokers(), dataOut);
+ looseMarshalString(info.getReconnectTo(), dataOut);
+ dataOut.writeBoolean(info.isRebalanceConnection());
+ looseMarshalByteArray(wireFormat, info.getToken(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionErrorMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..da58b80
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/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.v10;
+
+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/v10/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..6ee3176
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/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.v10;
+
+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/v10/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..e434940
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionInfoMarshaller.java
@@ -0,0 +1,195 @@
+/**
+ * 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.v10;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(bs.readBoolean());
+ info.setFaultTolerant(bs.readBoolean());
+ info.setFailoverReconnect(bs.readBoolean());
+ info.setClientIp(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 {
+ 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());
+ bs.writeBoolean(info.isClientMaster());
+ bs.writeBoolean(info.isFaultTolerant());
+ bs.writeBoolean(info.isFailoverReconnect());
+ rc += tightMarshalString1(info.getClientIp(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getClientIp(), 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);
+
+ ConnectionInfo info = (ConnectionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setFailoverReconnect(dataIn.readBoolean());
+ info.setClientIp(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isClientMaster());
+ dataOut.writeBoolean(info.isFaultTolerant());
+ dataOut.writeBoolean(info.isFailoverReconnect());
+ looseMarshalString(info.getClientIp(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerControlMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..818e8ce
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerControlMarshaller.java
@@ -0,0 +1,154 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+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.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setClose(bs.readBoolean());
+ info.setConsumerId((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isClose());
+ rc += tightMarshalNestedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalNestedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetch());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeBoolean(info.isClose());
+ looseMarshalNestedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeInt(info.getPrefetch());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..49b3088
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/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.v10;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..76756d1
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerInfoMarshaller.java
@@ -0,0 +1,253 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ControlCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ControlCommandMarshaller.java
new file mode 100644
index 0000000..adb93bb
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v10;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataArrayResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..8ffa998
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/DataArrayResponseMarshaller.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.v10;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
[10/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..b18697f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataArrayResponseMarshaller.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.v6;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataResponseMarshaller.java
new file mode 100644
index 0000000..2032dae
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v6;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..7586934
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v6;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..80c8e11
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/DiscoveryEventMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..0d53938
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/FlushCommandMarshaller.java
new file mode 100644
index 0000000..4a269a8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..cc03748
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..a06aae5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..b8bb81d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTraceMarshaller.java
new file mode 100644
index 0000000..bd94a09
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTraceMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..3230b8e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/JournalTransactionMarshaller.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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..6739799
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..16db04b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..b0577fa
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/LocalTransactionIdMarshaller.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.v6;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MarshallerFactory.java
new file mode 100644
index 0000000..b73b9ad
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v6;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageAckMarshaller.java
new file mode 100644
index 0000000..30dfdcf
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageAckMarshaller.java
@@ -0,0 +1,155 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ }
+}
[41/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DestinationInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..b564eb9
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v9;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DiscoveryEventMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..13a37e5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/DiscoveryEventMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ExceptionResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..cdf9c8b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/FlushCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/FlushCommandMarshaller.java
new file mode 100644
index 0000000..88aaa80
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/IntegerResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..2502d64
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalQueueAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..02d49c7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTopicAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..96220b6
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTraceMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTraceMarshaller.java
new file mode 100644
index 0000000..f7e9d55
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTraceMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTransactionMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..36336b8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/JournalTransactionMarshaller.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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/KeepAliveInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..52024f6
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LastPartialCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..bc98c37
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LocalTransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..12f55d5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/LocalTransactionIdMarshaller.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.v9;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(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/v9/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MarshallerFactory.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MarshallerFactory.java
new file mode 100644
index 0000000..400b780
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v9;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageAckMarshaller.java
new file mode 100644
index 0000000..069801e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageAckMarshaller.java
@@ -0,0 +1,160 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(tightUnmarsalThrowable(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 {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getPoisonCause(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ tightMarshalThrowable2(wireFormat, info.getPoisonCause(), 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ looseMarshalThrowable(wireFormat, info.getPoisonCause(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..30c911c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchNotificationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..a589e5f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
[29/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessage.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessage.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessage.java
new file mode 100644
index 0000000..ae7793c
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSStreamMessage.java
@@ -0,0 +1,710 @@
+/**
+ * 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.jms;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.StreamMessage;
+
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+
+/**
+ * Wrapper class that provides StreamMessage compliant mappings to the OpenWireStreamMessage
+ */
+public class OpenWireJMSStreamMessage extends OpenWireJMSMessage implements StreamMessage {
+
+ private final OpenWireStreamMessage message;
+
+ protected transient DataOutputStream dataOut;
+ protected transient ByteArrayOutputStream bytesOut;
+ protected transient DataInputStream dataIn;
+ protected transient int remainingBytes = -1;
+
+ /**
+ * Creates a new instance that wraps a new OpenWireMessage instance.
+ */
+ public OpenWireJMSStreamMessage() {
+ this(new OpenWireStreamMessage());
+ }
+
+ /**
+ * Creates a new instance that wraps the given OpenWireMessage
+ *
+ * @param message
+ * the OpenWireMessage to wrap.
+ */
+ public OpenWireJMSStreamMessage(OpenWireStreamMessage message) {
+ this.message = message;
+ }
+
+ @Override
+ public OpenWireJMSStreamMessage copy() throws JMSException {
+ OpenWireJMSStreamMessage other = new OpenWireJMSStreamMessage(message.copy());
+ copy(other);
+ return other;
+ }
+
+ private void copy(OpenWireJMSStreamMessage copy) throws JMSException {
+ storeContent();
+ super.copy(copy);
+ copy.dataOut = null;
+ copy.bytesOut = null;
+ copy.dataIn = null;
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ message.clearBody();
+ dataOut = null;
+ dataIn = null;
+ bytesOut = null;
+ remainingBytes = -1;
+ }
+
+ @Override
+ public boolean readBoolean() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(10);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.BOOLEAN_TYPE) {
+ return this.dataIn.readBoolean();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Boolean.valueOf(this.dataIn.readUTF()).booleanValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to boolean.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a boolean type");
+ }
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public byte readByte() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(10);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return this.dataIn.readByte();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Byte.valueOf(this.dataIn.readUTF()).byteValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to byte.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a byte type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public short readShort() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(17);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
+ return this.dataIn.readShort();
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return this.dataIn.readByte();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Short.valueOf(this.dataIn.readUTF()).shortValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to short.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a short type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public char readChar() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(17);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.CHAR_TYPE) {
+ return this.dataIn.readChar();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to char.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a char type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public int readInt() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(33);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.INTEGER_TYPE) {
+ return this.dataIn.readInt();
+ } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
+ return this.dataIn.readShort();
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return this.dataIn.readByte();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Integer.valueOf(this.dataIn.readUTF()).intValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to int.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not an int type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public long readLong() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(65);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.LONG_TYPE) {
+ return this.dataIn.readLong();
+ } else if (type == OpenWireMarshallingSupport.INTEGER_TYPE) {
+ return this.dataIn.readInt();
+ } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
+ return this.dataIn.readShort();
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return this.dataIn.readByte();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Long.valueOf(this.dataIn.readUTF()).longValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to long.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a long type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public float readFloat() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(33);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.FLOAT_TYPE) {
+ return this.dataIn.readFloat();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Float.valueOf(this.dataIn.readUTF()).floatValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to float.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a float type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public double readDouble() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(65);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.DOUBLE_TYPE) {
+ return this.dataIn.readDouble();
+ } else if (type == OpenWireMarshallingSupport.FLOAT_TYPE) {
+ return this.dataIn.readFloat();
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return Double.valueOf(this.dataIn.readUTF()).doubleValue();
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ this.dataIn.reset();
+ throw new NullPointerException("Cannot convert NULL value to double.");
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a double type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public String readString() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(65);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ return null;
+ } else if (type == OpenWireMarshallingSupport.BIG_STRING_TYPE) {
+ return OpenWireMarshallingSupport.readUTF8(dataIn);
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return this.dataIn.readUTF();
+ } else if (type == OpenWireMarshallingSupport.LONG_TYPE) {
+ return new Long(this.dataIn.readLong()).toString();
+ } else if (type == OpenWireMarshallingSupport.INTEGER_TYPE) {
+ return new Integer(this.dataIn.readInt()).toString();
+ } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
+ return new Short(this.dataIn.readShort()).toString();
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return new Byte(this.dataIn.readByte()).toString();
+ } else if (type == OpenWireMarshallingSupport.FLOAT_TYPE) {
+ return new Float(this.dataIn.readFloat()).toString();
+ } else if (type == OpenWireMarshallingSupport.DOUBLE_TYPE) {
+ return new Double(this.dataIn.readDouble()).toString();
+ } else if (type == OpenWireMarshallingSupport.BOOLEAN_TYPE) {
+ return (this.dataIn.readBoolean() ? Boolean.TRUE : Boolean.FALSE).toString();
+ } else if (type == OpenWireMarshallingSupport.CHAR_TYPE) {
+ return new Character(this.dataIn.readChar()).toString();
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException(" not a String type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ @Override
+ public int readBytes(byte[] value) throws JMSException {
+ initializeReading();
+ try {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ if (remainingBytes == -1) {
+ this.dataIn.mark(value.length + 1);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ }
+ if (type != OpenWireMarshallingSupport.BYTE_ARRAY_TYPE) {
+ throw new MessageFormatException("Not a byte array");
+ }
+ remainingBytes = this.dataIn.readInt();
+ } else if (remainingBytes == 0) {
+ remainingBytes = -1;
+ return -1;
+ }
+
+ if (value.length <= remainingBytes) {
+ // small buffer
+ remainingBytes -= value.length;
+ this.dataIn.readFully(value);
+ return value.length;
+ } else {
+ // big buffer
+ int rc = this.dataIn.read(value, 0, remainingBytes);
+ remainingBytes = 0;
+ return rc;
+ }
+ } catch (EOFException e) {
+ JMSException jmsEx = new MessageEOFException(e.getMessage());
+ jmsEx.setLinkedException(e);
+ throw jmsEx;
+ } catch (IOException e) {
+ JMSException jmsEx = new MessageFormatException(e.getMessage());
+ jmsEx.setLinkedException(e);
+ throw jmsEx;
+ }
+ }
+
+ @Override
+ public Object readObject() throws JMSException {
+ initializeReading();
+ try {
+ this.dataIn.mark(65);
+ int type = this.dataIn.read();
+ if (type == -1) {
+ throw new MessageEOFException("reached end of data");
+ } else if (type == OpenWireMarshallingSupport.NULL) {
+ return null;
+ } else if (type == OpenWireMarshallingSupport.BIG_STRING_TYPE) {
+ return OpenWireMarshallingSupport.readUTF8(dataIn);
+ } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
+ return this.dataIn.readUTF();
+ } else if (type == OpenWireMarshallingSupport.LONG_TYPE) {
+ return Long.valueOf(this.dataIn.readLong());
+ } else if (type == OpenWireMarshallingSupport.INTEGER_TYPE) {
+ return Integer.valueOf(this.dataIn.readInt());
+ } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
+ return Short.valueOf(this.dataIn.readShort());
+ } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
+ return Byte.valueOf(this.dataIn.readByte());
+ } else if (type == OpenWireMarshallingSupport.FLOAT_TYPE) {
+ return new Float(this.dataIn.readFloat());
+ } else if (type == OpenWireMarshallingSupport.DOUBLE_TYPE) {
+ return new Double(this.dataIn.readDouble());
+ } else if (type == OpenWireMarshallingSupport.BOOLEAN_TYPE) {
+ return this.dataIn.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
+ } else if (type == OpenWireMarshallingSupport.CHAR_TYPE) {
+ return Character.valueOf(this.dataIn.readChar());
+ } else if (type == OpenWireMarshallingSupport.BYTE_ARRAY_TYPE) {
+ int len = this.dataIn.readInt();
+ byte[] value = new byte[len];
+ this.dataIn.readFully(value);
+ return value;
+ } else {
+ this.dataIn.reset();
+ throw new MessageFormatException("unknown type");
+ }
+ } catch (NumberFormatException mfe) {
+ try {
+ this.dataIn.reset();
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ throw mfe;
+ } catch (EOFException e) {
+ JMSException jmsEx = new MessageEOFException(e.getMessage());
+ jmsEx.setLinkedException(e);
+ throw jmsEx;
+ } catch (IOException e) {
+ JMSException jmsEx = new MessageFormatException(e.getMessage());
+ jmsEx.setLinkedException(e);
+ throw jmsEx;
+ }
+ }
+
+ @Override
+ public void writeBoolean(boolean value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalBoolean(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeByte(byte value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalByte(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeShort(short value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalShort(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeChar(char value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalChar(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeInt(int value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalInt(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeLong(long value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalLong(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeFloat(float value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalFloat(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeDouble(double value) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalDouble(dataOut, value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeString(String value) throws JMSException {
+ initializeWriting();
+ try {
+ if (value == null) {
+ OpenWireMarshallingSupport.marshalNull(dataOut);
+ } else {
+ OpenWireMarshallingSupport.marshalString(dataOut, value);
+ }
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeBytes(byte[] value) throws JMSException {
+ writeBytes(value, 0, value.length);
+ }
+
+ @Override
+ public void writeBytes(byte[] value, int offset, int length) throws JMSException {
+ initializeWriting();
+ try {
+ OpenWireMarshallingSupport.marshalByteArray(dataOut, value, offset, length);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ @Override
+ public void writeObject(Object value) throws JMSException {
+ initializeWriting();
+ if (value == null) {
+ try {
+ OpenWireMarshallingSupport.marshalNull(dataOut);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ } else if (value instanceof String) {
+ writeString(value.toString());
+ } else if (value instanceof Character) {
+ writeChar(((Character)value).charValue());
+ } else if (value instanceof Boolean) {
+ writeBoolean(((Boolean)value).booleanValue());
+ } else if (value instanceof Byte) {
+ writeByte(((Byte)value).byteValue());
+ } else if (value instanceof Short) {
+ writeShort(((Short)value).shortValue());
+ } else if (value instanceof Integer) {
+ writeInt(((Integer)value).intValue());
+ } else if (value instanceof Float) {
+ writeFloat(((Float)value).floatValue());
+ } else if (value instanceof Double) {
+ writeDouble(((Double)value).doubleValue());
+ } else if (value instanceof byte[]) {
+ writeBytes((byte[])value);
+ } else if (value instanceof Long) {
+ writeLong(((Long)value).longValue());
+ } else {
+ throw new MessageFormatException("Unsupported Object type: " + value.getClass());
+ }
+ }
+
+ @Override
+ public void reset() throws JMSException {
+ storeContent();
+ setReadOnlyBody(true);
+ this.bytesOut = null;
+ this.dataIn = null;
+ this.dataOut = null;
+ this.remainingBytes = -1;
+ }
+
+ private void initializeWriting() throws JMSException {
+ checkReadOnlyBody();
+ if (this.dataOut == null) {
+ this.bytesOut = new ByteArrayOutputStream();
+ this.dataOut = new DataOutputStream(bytesOut);
+ }
+
+ // For a message that already had a body and was sent we need to restore the content
+ // if the message is used again without having its clearBody method called.
+ if (message.hasContent()) {
+ Buffer content = message.getPayload();
+ try {
+ this.dataOut.write(content.getData(), content.getOffset(), content.getLength());
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+ message.setContent(null);
+ }
+ }
+
+ private void initializeReading() throws MessageNotReadableException {
+ checkWriteOnlyBody();
+ if (this.dataIn == null) {
+ Buffer data;
+ try {
+ data = message.getPayload();
+ } catch (JMSException e) {
+ throw new MessageNotReadableException("Failed to read content from message.");
+ }
+ InputStream is = new ByteArrayInputStream(data);
+ this.dataIn = new DataInputStream(is);
+ }
+ }
+
+ private void storeContent() throws JMSException {
+ if (dataOut != null) {
+ try {
+ dataOut.close();
+ message.setPayload(bytesOut.toBuffer());
+ bytesOut = null;
+ dataOut = null;
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessage.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessage.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessage.java
new file mode 100644
index 0000000..c81f601
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSTextMessage.java
@@ -0,0 +1,78 @@
+/**
+ * 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.jms;
+
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+/**
+ * A wrapper around an OpenWireTextMessage.
+ */
+public class OpenWireJMSTextMessage extends OpenWireJMSMessage implements TextMessage {
+
+ private final OpenWireTextMessage message;
+
+ /**
+ * Creates a new instance that wraps a new OpenWireJMSTextMessage instance.
+ */
+ public OpenWireJMSTextMessage() {
+ this(new OpenWireTextMessage());
+ }
+
+ /**
+ * Creates a new instance of an OpenWireJMSTextMessage that wraps the
+ * given OpenWireTextMessage instance.
+ *
+ * @param message
+ * the message to wrap.
+ */
+ public OpenWireJMSTextMessage(OpenWireTextMessage message) {
+ super(message);
+ this.message = message;
+ }
+
+ @Override
+ public OpenWireJMSTextMessage copy() throws JMSException {
+ OpenWireJMSTextMessage other = new OpenWireJMSTextMessage(message.copy());
+ copy(other);
+ return other;
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ message.clearBody();
+ }
+
+ @Override
+ public void setText(String text) throws JMSException {
+ checkReadOnlyBody();
+ message.setText(text);
+ }
+
+ @Override
+ public String getText() throws JMSException {
+ return message.getText();
+ }
+
+ @Override
+ public String toString() {
+ return this.message.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertyGetter.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertyGetter.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertyGetter.java
new file mode 100644
index 0000000..cec7354
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertyGetter.java
@@ -0,0 +1,339 @@
+/**
+ * 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.jms.utils;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+/**
+ * Utility class used to intercept calls to Message property gets and map the
+ * correct OpenWire fields to the property name being queried.
+ */
+public class OpenWireMessagePropertyGetter {
+
+ private static final Map<String, PropertyGetter> PROPERTY_GETTERS = new HashMap<String, PropertyGetter>();
+
+ /**
+ * Interface for a Property Get intercepter object used to lookup JMS style
+ * properties that are part of the OpenWire Message object members or perform
+ * some needed conversion action before returned some named property.
+ */
+ public interface PropertyGetter {
+
+ /**
+ * Called when the names property is queried from an OpenWire Message object.
+ *
+ * @param message
+ * The message being acted upon.
+ *
+ * @return the correct property value from the given Message.
+ */
+ Object getProperty(OpenWireMessage message);
+ }
+
+ static {
+ PROPERTY_GETTERS.put("JMSDestination", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ Destination dest = message.getOriginalDestination();
+ if (dest == null) {
+ dest = message.getDestination();
+ }
+ if (dest == null) {
+ return null;
+ }
+ return dest.toString();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSReplyTo", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ if (message.getReplyTo() == null) {
+ return null;
+ }
+ return message.getReplyTo().toString();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSType", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return message.getType();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSDeliveryMode", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return message.isPersistent() ? "PERSISTENT" : "NON_PERSISTENT";
+ }
+ });
+ PROPERTY_GETTERS.put("JMSPriority", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Integer.valueOf(message.getPriority());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSMessageID", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ if (message.getMessageId() == null) {
+ return null;
+ }
+ return message.getMessageId().toString();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSTimestamp", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Long.valueOf(message.getTimestamp());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSCorrelationID", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return message.getCorrelationId();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSExpiration", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Long.valueOf(message.getExpiration());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSRedelivered", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Boolean.valueOf(message.isRedelivered());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXDeliveryCount", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Integer.valueOf(message.getRedeliveryCounter() + 1);
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXGroupID", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return message.getGroupId();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXUserID", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ Object userId = message.getUserId();
+ if (userId == null) {
+ try {
+ userId = message.getProperty("JMSXUserID");
+ } catch (JMSException e) {
+ }
+ }
+
+ return userId;
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXGroupSeq", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return new Integer(message.getGroupSequence());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXProducerTXID", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ TransactionId txId = message.getOriginalTransactionId();
+ if (txId == null) {
+ txId = message.getTransactionId();
+ }
+ if (txId == null) {
+ return null;
+ }
+ return txId.toString();
+ }
+ });
+ PROPERTY_GETTERS.put("JMSActiveMQBrokerInTime", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Long.valueOf(message.getBrokerInTime());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSActiveMQBrokerOutTime", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Long.valueOf(message.getBrokerOutTime());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSActiveMQBrokerPath", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Arrays.toString(message.getBrokerPath());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXGroupFirstForConsumer", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return Boolean.valueOf(message.isJMSXGroupFirstForConsumer());
+ }
+ });
+ PROPERTY_GETTERS.put("JMSXMimeType", new PropertyGetter() {
+ @Override
+ public Object getProperty(OpenWireMessage message) {
+ return String.valueOf(message.getMimeType());
+ }
+ });
+ }
+
+ /**
+ * For each of the currently configured message property intercepter instance a
+ * string key value is inserted into an Set and returned.
+ *
+ * @return a Set<String> containing the names of all intercepted properties.
+ */
+ public static Set<String> getPropertyNames() {
+ return PROPERTY_GETTERS.keySet();
+ }
+
+ /**
+ * Static get method that takes a property name and gets the value either via
+ * a registered property get object or through the OpenWireMessage getProperty
+ * method.
+ *
+ * @param message
+ * the OpenWireMessage instance to read from
+ * @param name
+ * the property name that is being requested.
+ *
+ * @return the correct value either mapped to an OpenWire attribute of a Message property.
+ *
+ * @throws JMSException if an error occurs while reading the defined property.
+ */
+ public static Object getProperty(OpenWireMessage message, String name) throws JMSException {
+ Object value = null;
+
+ PropertyGetter jmsPropertyExpression = PROPERTY_GETTERS.get(name);
+ if (jmsPropertyExpression != null) {
+ value = jmsPropertyExpression.getProperty(message);
+ } else {
+ value = message.getProperty(name);
+ }
+
+ return value;
+ }
+
+ /**
+ * Allows for the additional PropertyGetter instances to be added to the global set.
+ *
+ * @param propertyName
+ * The name of the Message property that will be intercepted.
+ * @param getter
+ * The PropertyGetter instance that should be used for the named property.
+ */
+ public static void addPropertyGetter(String propertyName, PropertyGetter getter) {
+ PROPERTY_GETTERS.put(propertyName, getter);
+ }
+
+ /**
+ * Given a property name, remove the configured getter that has been assigned to
+ * intercept the queries for that property value.
+ *
+ * @param propertyName
+ * The name of the Property Getter to remove.
+ *
+ * @return true if a getter was removed from the global set.
+ */
+ public boolean removePropertyGetter(String propertyName) {
+ if (PROPERTY_GETTERS.remove(propertyName) != null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private final String name;
+ private final PropertyGetter jmsPropertyExpression;
+
+ /**
+ * Creates an new property getter instance that is assigned to read the named value.
+ *
+ * @param name
+ * the property value that this getter is assigned to lookup.
+ */
+ public OpenWireMessagePropertyGetter(String name) {
+ this.name = name;
+ jmsPropertyExpression = PROPERTY_GETTERS.get(name);
+ }
+
+ /**
+ * Gets the correct property value from the OpenWireMessage instance based on
+ * the predefined property mappings.
+ *
+ * @param message
+ * the OpenWireMessage whose property is being read.
+ *
+ * @return the correct value either mapped to an OpenWire attribute of a Message property.
+ *
+ * @throws JMSException if an error occurs while reading the defined property.
+ */
+ public Object get(OpenWireMessage message) throws JMSException {
+ if (jmsPropertyExpression != null) {
+ return jmsPropertyExpression.getProperty(message);
+ }
+
+ return message.getProperty(name);
+ }
+
+ /**
+ * @return the property name that is being intercepted for the OpenWireMessage.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == null || !this.getClass().equals(o.getClass())) {
+ return false;
+ }
+ return name.equals(((OpenWireMessagePropertyGetter) o).name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertySetter.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertySetter.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertySetter.java
new file mode 100644
index 0000000..d3f6854
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/OpenWireMessagePropertySetter.java
@@ -0,0 +1,305 @@
+/**
+ * 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.jms.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+/**
+ * Utility class used to intercept calls to Message property sets and map the
+ * correct OpenWire fields to the property name being set.
+ */
+public class OpenWireMessagePropertySetter {
+
+ private static final Map<String, PropertySetter> PROPERTY_SETTERS = new HashMap<String, PropertySetter>();
+
+ /**
+ * Interface for a Property Set intercepter object used to write JMS style
+ * properties that are part of the OpenWire Message object members or perform
+ * some needed conversion action before some named property is set.
+ */
+ interface PropertySetter {
+
+ /**
+ * Called when the names property is assigned from an OpenWire Message object.
+ *
+ * @param message
+ * The message instance being acted upon.
+ * @param value
+ * The value to assign to the intercepted property.
+ *
+ * @throws MessageFormatException if an error occurs writing the property.
+s */
+ void setProperty(OpenWireMessage message, Object value) throws MessageFormatException;
+ }
+
+ static {
+ PROPERTY_SETTERS.put("JMSXDeliveryCount", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSXDeliveryCount cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setRedeliveryCounter(rc.intValue() - 1);
+ }
+ });
+ PROPERTY_SETTERS.put("JMSXGroupID", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ String rc = (String) TypeConversionSupport.convert(value, String.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSXGroupID cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setGroupID(rc);
+ }
+ });
+ PROPERTY_SETTERS.put("JMSXGroupSeq", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSXGroupSeq cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setGroupSequence(rc.intValue());
+ }
+ });
+ PROPERTY_SETTERS.put("JMSCorrelationID", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ String rc = (String) TypeConversionSupport.convert(value, String.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSCorrelationID cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setCorrelationId(rc);
+ }
+ });
+ PROPERTY_SETTERS.put("JMSDeliveryMode", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
+ if (rc == null) {
+ Boolean bool = (Boolean) TypeConversionSupport.convert(value, Boolean.class);
+ if (bool == null) {
+ throw new MessageFormatException("Property JMSDeliveryMode cannot be set from a " + value.getClass().getName() + ".");
+ } else {
+ message.setPersistent(bool.booleanValue());
+ }
+ } else {
+ message.setPersistent(rc == DeliveryMode.PERSISTENT);
+ }
+ }
+ });
+ PROPERTY_SETTERS.put("JMSExpiration", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Long rc = (Long) TypeConversionSupport.convert(value, Long.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSExpiration cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setExpiration(rc.longValue());
+ }
+ });
+ PROPERTY_SETTERS.put("JMSPriority", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSPriority cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setPriority(rc.byteValue());
+ }
+ });
+ PROPERTY_SETTERS.put("JMSRedelivered", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Boolean rc = (Boolean) TypeConversionSupport.convert(value, Boolean.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSRedelivered cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setRedelivered(rc.booleanValue());
+ }
+ });
+ PROPERTY_SETTERS.put("JMSReplyTo", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ OpenWireDestination rc = (OpenWireDestination) TypeConversionSupport.convert(value, OpenWireDestination.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSReplyTo cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setReplyTo(rc);
+ }
+ });
+ PROPERTY_SETTERS.put("JMSTimestamp", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ Long rc = (Long) TypeConversionSupport.convert(value, Long.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSTimestamp cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setTimestamp(rc.longValue());
+ }
+ });
+ PROPERTY_SETTERS.put("JMSType", new PropertySetter() {
+ @Override
+ public void setProperty(OpenWireMessage message, Object value) throws MessageFormatException {
+ String rc = (String) TypeConversionSupport.convert(value, String.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property JMSType cannot be set from a " + value.getClass().getName() + ".");
+ }
+ message.setType(rc);
+ }
+ });
+ }
+
+ /**
+ * Static set method that takes a property name and sets the value either via
+ * a registered property set object or through the OpenWireMessage setProperty
+ * method.
+ *
+ * @param message
+ * the OpenWireMessage instance to write to.
+ * @param name
+ * the property name that is being written.
+ * @param value
+ * the new value to assign for the named property.
+ *
+ * @throws JMSException if an error occurs while writting the defined property.
+ */
+ public static void setProperty(OpenWireMessage message, String name, Object value) throws JMSException {
+ PropertySetter jmsPropertyExpression = PROPERTY_SETTERS.get(name);
+ if (jmsPropertyExpression != null) {
+ jmsPropertyExpression.setProperty(message, value);
+ } else {
+ message.setProperty(name, value);
+ }
+ }
+
+ /**
+ * Allows for the additional PropertySetter instances to be added to the global set.
+ *
+ * @param propertyName
+ * The name of the Message property that will be intercepted.
+ * @param getter
+ * The PropertySetter instance that should be used for the named property.
+ */
+ public static void addPropertySetter(String propertyName, PropertySetter getter) {
+ PROPERTY_SETTERS.put(propertyName, getter);
+ }
+
+ /**
+ * Given a property name, remove the configured getter that has been assigned to
+ * intercept the queries for that property value.
+ *
+ * @param propertyName
+ * The name of the Property Getter to remove.
+ *
+ * @return true if a getter was removed from the global set.
+ */
+ public boolean removePropertySetter(String propertyName) {
+ if (PROPERTY_SETTERS.remove(propertyName) != null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private final String name;
+ private final PropertySetter jmsPropertyExpression;
+
+ /**
+ * For each of the currently configured message property intercepter instance a
+ * string key value is inserted into an Set and returned.
+ *
+ * @return a Set<String> containing the names of all intercepted properties.
+ */
+ public static Set<String> getPropertyNames() {
+ return PROPERTY_SETTERS.keySet();
+ }
+
+ /**
+ * Creates an new property getter instance that is assigned to read the named value.
+ *
+ * @param name
+ * the property value that this getter is assigned to lookup.
+ */
+ public OpenWireMessagePropertySetter(String name) {
+ this.name = name;
+ jmsPropertyExpression = PROPERTY_SETTERS.get(name);
+ }
+
+ /**
+ * Sets the correct property value from the OpenWireMessage instance based on
+ * the predefined property mappings.
+ *
+ * @param message
+ * the OpenWireMessage whose property is being read.
+ * @param value
+ * the value to be set on the intercepted OpenWireMessage property.
+ *
+ * @throws JMSException if an error occurs while reading the defined property.
+ */
+ public void set(OpenWireMessage message, Object value) throws JMSException {
+ if (jmsPropertyExpression != null) {
+ jmsPropertyExpression.setProperty(message, value);
+ } else {
+ message.setProperty(name, value);
+ }
+ }
+
+ /**
+ * @return the property name that is being intercepted for the OpenWireMessage.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == null || !this.getClass().equals(o.getClass())) {
+ return false;
+ }
+ return name.equals(((OpenWireMessagePropertySetter) o).name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/TypeConversionSupport.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/TypeConversionSupport.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/TypeConversionSupport.java
new file mode 100644
index 0000000..a4121e4
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/utils/TypeConversionSupport.java
@@ -0,0 +1,255 @@
+/**
+ * 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.jms.utils;
+
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * Type conversion support for OpenWireMessage property types.
+ */
+public final class TypeConversionSupport {
+
+ private static final Converter IDENTITY_CONVERTER = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return value;
+ }
+ };
+
+ private static class ConversionKey {
+ final Class<?> from;
+ final Class<?> to;
+ final int hashCode;
+
+ public ConversionKey(Class<?> from, Class<?> to) {
+ this.from = from;
+ this.to = to;
+ this.hashCode = from.hashCode() ^ (to.hashCode() << 1);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ ConversionKey x = (ConversionKey) o;
+ return x.from == from && x.to == to;
+ }
+
+ @Override
+ public int hashCode() {
+ return hashCode;
+ }
+ }
+
+ public interface Converter {
+ Object convert(Object value);
+ }
+
+ private static final Map<ConversionKey, Converter> CONVERSION_MAP = new HashMap<ConversionKey, Converter>();
+ static {
+ Converter toStringConverter = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return value.toString();
+ }
+ };
+ CONVERSION_MAP.put(new ConversionKey(Boolean.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Short.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Integer.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Long.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Float.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(Double.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(UTF8Buffer.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(URI.class, String.class), toStringConverter);
+ CONVERSION_MAP.put(new ConversionKey(BigInteger.class, String.class), toStringConverter);
+
+ CONVERSION_MAP.put(new ConversionKey(String.class, Boolean.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Boolean.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Byte.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Byte.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Short.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Short.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Integer.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Integer.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Long.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Long.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Float.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Float.valueOf((String) value);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, Double.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Double.valueOf((String) value);
+ }
+ });
+
+ Converter longConverter = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Long.valueOf(((Number) value).longValue());
+ }
+ };
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, Long.class), longConverter);
+ CONVERSION_MAP.put(new ConversionKey(Short.class, Long.class), longConverter);
+ CONVERSION_MAP.put(new ConversionKey(Integer.class, Long.class), longConverter);
+ CONVERSION_MAP.put(new ConversionKey(Date.class, Long.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Long.valueOf(((Date) value).getTime());
+ }
+ });
+
+ Converter intConverter = new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Integer.valueOf(((Number) value).intValue());
+ }
+ };
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, Integer.class), intConverter);
+ CONVERSION_MAP.put(new ConversionKey(Short.class, Integer.class), intConverter);
+
+ CONVERSION_MAP.put(new ConversionKey(Byte.class, Short.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return Short.valueOf(((Number) value).shortValue());
+ }
+ });
+
+ CONVERSION_MAP.put(new ConversionKey(Float.class, Double.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return new Double(((Number) value).doubleValue());
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, OpenWireDestination.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ return OpenWireDestination.createDestination((String) value, OpenWireDestination.QUEUE_TYPE);
+ }
+ });
+ CONVERSION_MAP.put(new ConversionKey(String.class, URI.class), new Converter() {
+ @Override
+ public Object convert(Object value) {
+ String text = value.toString();
+ try {
+ return new URI(text);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+
+ private TypeConversionSupport() {
+ }
+
+ public static Object convert(Object value, Class<?> to) {
+ if (value == null) {
+ // lets avoid NullPointerException when converting to boolean for null values
+ if (boolean.class.isAssignableFrom(to)) {
+ return Boolean.FALSE;
+ }
+ return null;
+ }
+
+ // eager same instance type test to avoid the overhead of invoking the
+ // type converter if already same type
+ if (to.isInstance(value)) {
+ return to.cast(value);
+ }
+
+ // lookup converter
+ Converter c = lookupConverter(value.getClass(), to);
+ if (c != null) {
+ return c.convert(value);
+ } else {
+ return null;
+ }
+ }
+
+ public static Converter lookupConverter(Class<?> from, Class<?> to) {
+ // use wrapped type for primitives
+ if (from.isPrimitive()) {
+ from = convertPrimitiveTypeToWrapperType(from);
+ }
+ if (to.isPrimitive()) {
+ to = convertPrimitiveTypeToWrapperType(to);
+ }
+
+ if (from.equals(to)) {
+ return IDENTITY_CONVERTER;
+ }
+
+ return CONVERSION_MAP.get(new ConversionKey(from, to));
+ }
+
+ /**
+ * Converts primitive types such as int to its wrapper type like
+ * {@link Integer}
+ */
+ private static Class<?> convertPrimitiveTypeToWrapperType(Class<?> type) {
+ Class<?> rc = type;
+ if (type.isPrimitive()) {
+ if (type == int.class) {
+ rc = Integer.class;
+ } else if (type == long.class) {
+ rc = Long.class;
+ } else if (type == double.class) {
+ rc = Double.class;
+ } else if (type == float.class) {
+ rc = Float.class;
+ } else if (type == short.class) {
+ rc = Short.class;
+ } else if (type == byte.class) {
+ rc = Byte.class;
+ } else if (type == boolean.class) {
+ rc = Boolean.class;
+ }
+ }
+ return rc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessageTest.java b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessageTest.java
new file mode 100644
index 0000000..04f19b2
--- /dev/null
+++ b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessageTest.java
@@ -0,0 +1,487 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.jms.OpenWireJMSBytesMessage;
+import org.junit.Test;
+
+/**
+ * Test that the OpenWireJMSBytesMessage object is JMS Compliant.
+ */
+public class OpenWireJMSBytesMessageTest {
+
+ @Test
+ public void testGetDataStructureType() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ assertEquals(CommandTypes.OPENWIRE_BYTES_MESSAGE, msg.getOpenWireMessage().getDataStructureType());
+ }
+
+ @Test
+ public void testGetBodyLength() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ int len = 10;
+ try {
+ for (int i = 0; i < len; i++) {
+ msg.writeLong(5L);
+ }
+ } catch (JMSException ex) {
+ ex.printStackTrace();
+ }
+ try {
+ msg.reset();
+ assertTrue(msg.getBodyLength() == (len * 8));
+ } catch (Throwable e) {
+ e.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadBoolean() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeBoolean(true);
+ msg.reset();
+ assertTrue(msg.readBoolean());
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadByte() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeByte((byte) 2);
+ msg.reset();
+ assertTrue(msg.readByte() == 2);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadUnsignedByte() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeByte((byte) 2);
+ msg.reset();
+ assertTrue(msg.readUnsignedByte() == 2);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadShort() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeShort((short) 3000);
+ msg.reset();
+ assertTrue(msg.readShort() == 3000);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadUnsignedShort() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeShort((short) 3000);
+ msg.reset();
+ assertTrue(msg.readUnsignedShort() == 3000);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadChar() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeChar('a');
+ msg.reset();
+ assertTrue(msg.readChar() == 'a');
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadInt() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeInt(3000);
+ msg.reset();
+ assertTrue(msg.readInt() == 3000);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadLong() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeLong(3000);
+ msg.reset();
+ assertTrue(msg.readLong() == 3000);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadFloat() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeFloat(3.3f);
+ msg.reset();
+ assertTrue(msg.readFloat() == 3.3f);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadDouble() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeDouble(3.3d);
+ msg.reset();
+ assertTrue(msg.readDouble() == 3.3d);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadUTF() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ String str = "this is a test";
+ msg.writeUTF(str);
+ msg.reset();
+ assertTrue(msg.readUTF().equals(str));
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReadBytesbyteArray() {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ byte[] data = new byte[50];
+ for (int i = 0; i < data.length; i++) {
+ data[i] = (byte) i;
+ }
+ msg.writeBytes(data);
+ msg.reset();
+ byte[] test = new byte[data.length];
+ msg.readBytes(test);
+ for (int i = 0; i < test.length; i++) {
+ assertTrue(test[i] == i);
+ }
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testWriteObject() throws JMSException {
+ OpenWireJMSBytesMessage msg = new OpenWireJMSBytesMessage();
+ try {
+ msg.writeObject("fred");
+ msg.writeObject(Boolean.TRUE);
+ msg.writeObject(Character.valueOf('q'));
+ msg.writeObject(Byte.valueOf((byte) 1));
+ msg.writeObject(Short.valueOf((short) 3));
+ msg.writeObject(Integer.valueOf(3));
+ msg.writeObject(Long.valueOf(300L));
+ msg.writeObject(new Float(3.3f));
+ msg.writeObject(new Double(3.3));
+ msg.writeObject(new byte[3]);
+ } catch (MessageFormatException mfe) {
+ fail("objectified primitives should be allowed");
+ }
+ try {
+ msg.writeObject(new Object());
+ fail("only objectified primitives are allowed");
+ } catch (MessageFormatException mfe) {
+ }
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireJMSBytesMessage bytesMessage = new OpenWireJMSBytesMessage();
+ try {
+ bytesMessage.writeInt(1);
+ bytesMessage.clearBody();
+ assertFalse(bytesMessage.isReadOnlyBody());
+ bytesMessage.writeInt(1);
+ bytesMessage.readInt();
+ } catch (MessageNotReadableException mnwe) {
+ } catch (MessageNotWriteableException mnwe) {
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testReset() throws JMSException {
+ OpenWireJMSBytesMessage message = new OpenWireJMSBytesMessage();
+ try {
+ message.writeDouble(24.5);
+ message.writeLong(311);
+ } catch (MessageNotWriteableException mnwe) {
+ fail("should be writeable");
+ }
+ message.reset();
+ try {
+ assertTrue(message.isReadOnlyBody());
+ assertEquals(message.readDouble(), 24.5, 0);
+ assertEquals(message.readLong(), 311);
+ } catch (MessageNotReadableException mnre) {
+ fail("should be readable");
+ }
+ try {
+ message.writeInt(33);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testReadOnlyBody() throws JMSException {
+ OpenWireJMSBytesMessage message = new OpenWireJMSBytesMessage();
+ try {
+ message.writeBoolean(true);
+ message.writeByte((byte) 1);
+ message.writeByte((byte) 1);
+ message.writeBytes(new byte[1]);
+ message.writeBytes(new byte[3], 0, 2);
+ message.writeChar('a');
+ message.writeDouble(1.5);
+ message.writeFloat((float) 1.5);
+ message.writeInt(1);
+ message.writeLong(1);
+ message.writeObject("stringobj");
+ message.writeShort((short) 1);
+ message.writeShort((short) 1);
+ message.writeUTF("utfstring");
+ } catch (MessageNotWriteableException mnwe) {
+ fail("Should be writeable");
+ }
+ message.reset();
+ try {
+ message.readBoolean();
+ message.readByte();
+ message.readUnsignedByte();
+ message.readBytes(new byte[1]);
+ message.readBytes(new byte[2], 2);
+ message.readChar();
+ message.readDouble();
+ message.readFloat();
+ message.readInt();
+ message.readLong();
+ message.readUTF();
+ message.readShort();
+ message.readUnsignedShort();
+ message.readUTF();
+ } catch (MessageNotReadableException mnwe) {
+ fail("Should be readable");
+ }
+ try {
+ message.writeBoolean(true);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeByte((byte) 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeBytes(new byte[3], 0, 2);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeChar('a');
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeDouble(1.5);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeFloat((float) 1.5);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeInt(1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeLong(1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeObject("stringobj");
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeShort((short) 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ message.writeUTF("utfstring");
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testWriteOnlyBody() throws JMSException {
+ OpenWireJMSBytesMessage message = new OpenWireJMSBytesMessage();
+ message.clearBody();
+ try {
+ message.writeBoolean(true);
+ message.writeByte((byte) 1);
+ message.writeByte((byte) 1);
+ message.writeBytes(new byte[1]);
+ message.writeBytes(new byte[3], 0, 2);
+ message.writeChar('a');
+ message.writeDouble(1.5);
+ message.writeFloat((float) 1.5);
+ message.writeInt(1);
+ message.writeLong(1);
+ message.writeObject("stringobj");
+ message.writeShort((short) 1);
+ message.writeShort((short) 1);
+ message.writeUTF("utfstring");
+ } catch (MessageNotWriteableException mnwe) {
+ fail("Should be writeable");
+ }
+ try {
+ message.readBoolean();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException mnwe) {
+ }
+ try {
+ message.readByte();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readUnsignedByte();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readBytes(new byte[1]);
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readBytes(new byte[2], 2);
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readChar();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readDouble();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readFloat();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readInt();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readLong();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readUTF();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readShort();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readUnsignedShort();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ try {
+ message.readUTF();
+ fail("Should have thrown exception");
+ } catch (MessageNotReadableException e) {
+ }
+ }
+}
[30/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/resources/log4j.properties b/openwire-interop-tests/src/test/resources/log4j.properties
new file mode 100644
index 0000000..0588275
--- /dev/null
+++ b/openwire-interop-tests/src/test/resources/log4j.properties
@@ -0,0 +1,41 @@
+## ---------------------------------------------------------------------------
+## 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
+
+# Tune the ActiveMQ and it's OpenWire transport as needed for debugging.
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.broker=DEBUG
+log4j.logger.org.apache.activemq.transport.openwire=TRACE
+log4j.logger.org.apache.activemq.transport.openwire.FRAMES=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/7ae454fa/openwire-jms/.gitignore
----------------------------------------------------------------------
diff --git a/openwire-jms/.gitignore b/openwire-jms/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/openwire-jms/.gitignore
@@ -0,0 +1 @@
+/target
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-jms/pom.xml b/openwire-jms/pom.xml
new file mode 100644
index 0000000..a68d4a4
--- /dev/null
+++ b/openwire-jms/pom.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-protocol</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openwire-jms</artifactId>
+ <name>openwire-jms</name>
+ <description>OpenWire JMS Message mappings allowing for easier implementation of a JMS client using OpenWire</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <!-- =================================== -->
+ <!-- Required Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </dependency>
+
+ <!-- =================================== -->
+ <!-- Testing Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <version>${activemq-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-kahadb-store</artifactId>
+ <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/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessage.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessage.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessage.java
new file mode 100644
index 0000000..8ce1c1a
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSBytesMessage.java
@@ -0,0 +1,783 @@
+/**
+ * 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.jms;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+
+/**
+ * Wrapper class that provides ByteMessage compliant mappings to the OpenWireBytesMessage
+ */
+public class OpenWireJMSBytesMessage extends OpenWireJMSMessage implements BytesMessage {
+
+ private final OpenWireBytesMessage message;
+
+ protected transient DataOutputStream dataOut;
+ protected transient ByteArrayOutputStream bytesOut;
+ protected transient DataInputStream dataIn;
+ protected transient int length;
+
+ /**
+ * Creates a new instance that wraps a new OpenWireJMSBytesMessage instance.
+ */
+ public OpenWireJMSBytesMessage() {
+ this(new OpenWireBytesMessage());
+ }
+
+ /**
+ * Creates a new instance that wraps the given OpenWireJMSBytesMessage
+ *
+ * @param message
+ * the OpenWireMessage to wrap.
+ */
+ public OpenWireJMSBytesMessage(OpenWireBytesMessage message) {
+ super(message);
+ this.message = message;
+ }
+
+ @Override
+ public OpenWireJMSBytesMessage copy() throws JMSException {
+ storeContent();
+ OpenWireJMSBytesMessage other = new OpenWireJMSBytesMessage(message.copy());
+ other.copy(this);
+ return other;
+ }
+
+ private void copy(OpenWireJMSBytesMessage other) throws JMSException {
+ super.copy(other);
+ bytesOut = null;
+ dataIn = null;
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ message.clearBody();
+ dataOut = null;
+ dataIn = null;
+ bytesOut = null;
+ }
+
+ @Override
+ public long getBodyLength() throws JMSException {
+ return message.getBodyLength();
+ }
+
+ /**
+ * Reads a <code>boolean</code> from the bytes message stream.
+ *
+ * @return the <code>boolean</code> value read
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public boolean readBoolean() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readBoolean();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a signed 8-bit value from the bytes message stream.
+ *
+ * @return the next byte from the bytes message stream as a signed 8-bit
+ * <code>byte</code>
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public byte readByte() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readByte();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads an unsigned 8-bit number from the bytes message stream.
+ *
+ * @return the next byte from the bytes message stream, interpreted as an
+ * unsigned 8-bit number
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public int readUnsignedByte() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readUnsignedByte();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a signed 16-bit number from the bytes message stream.
+ *
+ * @return the next two bytes from the bytes message stream, interpreted as
+ * a signed 16-bit number
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public short readShort() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readShort();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads an unsigned 16-bit number from the bytes message stream.
+ *
+ * @return the next two bytes from the bytes message stream, interpreted as
+ * an unsigned 16-bit integer
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public int readUnsignedShort() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readUnsignedShort();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a Unicode character value from the bytes message stream.
+ *
+ * @return the next two bytes from the bytes message stream as a Unicode
+ * character
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public char readChar() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readChar();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a signed 32-bit integer from the bytes message stream.
+ *
+ * @return the next four bytes from the bytes message stream, interpreted as
+ * an <code>int</code>
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public int readInt() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readInt();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a signed 64-bit integer from the bytes message stream.
+ *
+ * @return the next eight bytes from the bytes message stream, interpreted
+ * as a <code>long</code>
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public long readLong() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readLong();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a <code>float</code> from the bytes message stream.
+ *
+ * @return the next four bytes from the bytes message stream, interpreted as
+ * a <code>float</code>
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public float readFloat() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readFloat();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a <code>double</code> from the bytes message stream.
+ *
+ * @return the next eight bytes from the bytes message stream, interpreted
+ * as a <code>double</code>
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public double readDouble() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readDouble();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a string that has been encoded using a modified UTF-8 format from
+ * the bytes message stream.
+ * <P>
+ * For more information on the UTF-8 format, see "File System Safe UCS
+ * Transformation Format (FSS_UTF)", X/Open Preliminary Specification,
+ * X/Open Company Ltd., Document Number: P316. This information also appears
+ * in ISO/IEC 10646, Annex P.
+ *
+ * @return a Unicode string from the bytes message stream
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageEOFException if unexpected end of bytes stream has been
+ * reached.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public String readUTF() throws JMSException {
+ initializeReading();
+ try {
+ return this.dataIn.readUTF();
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Reads a byte array from the bytes message stream.
+ * <P>
+ * If the length of array <code>value</code> is less than the number of
+ * bytes remaining to be read from the stream, the array should be filled. A
+ * subsequent call reads the next increment, and so on.
+ * <P>
+ * If the number of bytes remaining in the stream is less than the length of
+ * array <code>value</code>, the bytes should be read into the array. The
+ * return value of the total number of bytes read will be less than the
+ * length of the array, indicating that there are no more bytes left to be
+ * read from the stream. The next read of the stream returns -1.
+ *
+ * @param value the buffer into which the data is read
+ * @return the total number of bytes read into the buffer, or -1 if there is
+ * no more data because the end of the stream has been reached
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public int readBytes(byte[] value) throws JMSException {
+ return readBytes(value, value.length);
+ }
+
+ /**
+ * Reads a portion of the bytes message stream.
+ * <P>
+ * If the length of array <code>value</code> is less than the number of
+ * bytes remaining to be read from the stream, the array should be filled. A
+ * subsequent call reads the next increment, and so on.
+ * <P>
+ * If the number of bytes remaining in the stream is less than the length of
+ * array <code>value</code>, the bytes should be read into the array. The
+ * return value of the total number of bytes read will be less than the
+ * length of the array, indicating that there are no more bytes left to be
+ * read from the stream. The next read of the stream returns -1. <p/> If
+ * <code>length</code> is negative, or <code>length</code> is greater
+ * than the length of the array <code>value</code>, then an
+ * <code>IndexOutOfBoundsException</code> is thrown. No bytes will be read
+ * from the stream for this exception case.
+ *
+ * @param value the buffer into which the data is read
+ * @param length the number of bytes to read; must be less than or equal to
+ * <code>value.length</code>
+ * @return the total number of bytes read into the buffer, or -1 if there is
+ * no more data because the end of the stream has been reached
+ * @throws JMSException if the JMS provider fails to read the message due to
+ * some internal error.
+ * @throws MessageNotReadableException if the message is in write-only mode.
+ */
+ @Override
+ public int readBytes(byte[] value, int length) throws JMSException {
+ initializeReading();
+ try {
+ int n = 0;
+ while (n < length) {
+ int count = this.dataIn.read(value, n, length - n);
+ if (count < 0) {
+ break;
+ }
+ n += count;
+ }
+ if (n == 0 && length > 0) {
+ n = -1;
+ }
+ return n;
+ } catch (EOFException e) {
+ throw ExceptionSupport.createMessageEOFException(e);
+ } catch (IOException e) {
+ throw ExceptionSupport.createMessageFormatException(e);
+ }
+ }
+
+ /**
+ * Writes a <code>boolean</code> to the bytes message stream as a 1-byte
+ * value. The value <code>true</code> is written as the value
+ * <code>(byte)1</code>; the value <code>false</code> is written as the
+ * value <code>(byte)0</code>.
+ *
+ * @param value the <code>boolean</code> value to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeBoolean(boolean value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeBoolean(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a <code>byte</code> to the bytes message stream as a 1-byte
+ * value.
+ *
+ * @param value the <code>byte</code> value to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeByte(byte value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeByte(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a <code>short</code> to the bytes message stream as two bytes,
+ * high byte first.
+ *
+ * @param value the <code>short</code> to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeShort(short value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeShort(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a <code>char</code> to the bytes message stream as a 2-byte
+ * value, high byte first.
+ *
+ * @param value the <code>char</code> value to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeChar(char value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeChar(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes an <code>int</code> to the bytes message stream as four bytes,
+ * high byte first.
+ *
+ * @param value the <code>int</code> to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeInt(int value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeInt(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a <code>long</code> to the bytes message stream as eight bytes,
+ * high byte first.
+ *
+ * @param value the <code>long</code> to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeLong(long value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeLong(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Converts the <code>float</code> argument to an <code>int</code> using
+ * the <code>floatToIntBits</code> method in class <code>Float</code>,
+ * and then writes that <code>int</code> value to the bytes message stream
+ * as a 4-byte quantity, high byte first.
+ *
+ * @param value the <code>float</code> value to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeFloat(float value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeFloat(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Converts the <code>double</code> argument to a <code>long</code>
+ * using the <code>doubleToLongBits</code> method in class
+ * <code>Double</code>, and then writes that <code>long</code> value to
+ * the bytes message stream as an 8-byte quantity, high byte first.
+ *
+ * @param value the <code>double</code> value to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeDouble(double value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeDouble(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a string to the bytes message stream using UTF-8 encoding in a
+ * machine-independent manner.
+ * <P>
+ * For more information on the UTF-8 format, see "File System Safe UCS
+ * Transformation Format (FSS_UTF)", X/Open Preliminary Specification,
+ * X/Open Company Ltd., Document Number: P316. This information also appears
+ * in ISO/IEC 10646, Annex P.
+ *
+ * @param value the <code>String</code> value to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeUTF(String value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.writeUTF(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a byte array to the bytes message stream.
+ *
+ * @param value the byte array to be written
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeBytes(byte[] value) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.write(value);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes a portion of a byte array to the bytes message stream.
+ *
+ * @param value the byte array value to be written
+ * @param offset the initial offset within the byte array
+ * @param length the number of bytes to use
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ */
+ @Override
+ public void writeBytes(byte[] value, int offset, int length) throws JMSException {
+ initializeWriting();
+ try {
+ this.dataOut.write(value, offset, length);
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ /**
+ * Writes an object to the bytes message stream.
+ * <P>
+ * This method works only for the objectified primitive object types (<code>Integer</code>,<code>Double</code>,
+ * <code>Long</code> ...), <code>String</code> objects, and byte
+ * arrays.
+ *
+ * @param value the object in the Java programming language ("Java object")
+ * to be written; it must not be null
+ * @throws JMSException if the JMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageFormatException if the object is of an invalid type.
+ * @throws MessageNotWriteableException if the message is in read-only mode.
+ * @throws java.lang.NullPointerException if the parameter
+ * <code>value</code> is null.
+ */
+ @Override
+ public void writeObject(Object value) throws JMSException {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ initializeWriting();
+ if (value instanceof Boolean) {
+ writeBoolean(((Boolean)value).booleanValue());
+ } else if (value instanceof Character) {
+ writeChar(((Character)value).charValue());
+ } else if (value instanceof Byte) {
+ writeByte(((Byte)value).byteValue());
+ } else if (value instanceof Short) {
+ writeShort(((Short)value).shortValue());
+ } else if (value instanceof Integer) {
+ writeInt(((Integer)value).intValue());
+ } else if (value instanceof Long) {
+ writeLong(((Long)value).longValue());
+ } else if (value instanceof Float) {
+ writeFloat(((Float)value).floatValue());
+ } else if (value instanceof Double) {
+ writeDouble(((Double)value).doubleValue());
+ } else if (value instanceof String) {
+ writeUTF(value.toString());
+ } else if (value instanceof byte[]) {
+ writeBytes((byte[])value);
+ } else {
+ throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass());
+ }
+ }
+
+ @Override
+ public void reset() throws JMSException {
+ storeContent();
+ setReadOnlyBody(true);
+ try {
+ if (bytesOut != null) {
+ bytesOut.close();
+ bytesOut = null;
+ }
+ if (dataIn != null) {
+ dataIn.close();
+ dataIn = null;
+ }
+ if (dataOut != null) {
+ dataOut.close();
+ dataOut = null;
+ }
+ } catch (IOException ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+
+ private void initializeWriting() throws JMSException {
+ checkReadOnlyBody();
+ if (this.dataOut == null) {
+ this.bytesOut = new ByteArrayOutputStream();
+ OutputStream os = bytesOut;
+ this.dataOut = new DataOutputStream(os);
+ }
+
+ restoreOldContent();
+ }
+
+ private void restoreOldContent() throws JMSException {
+ // For a message that already had a body and was sent we need to restore the content
+ // if the message is used again without having its clearBody method called.
+ byte[] oldContent = message.getBodyBytes();
+ if (oldContent.length != 0) {
+ try {
+ dataOut.write(oldContent);
+ } catch (IOException e) {
+ throw ExceptionSupport.create(e);
+ }
+
+ // Clear old buffer as we are in write mode, only a call to reset can
+ // put us back in read mode and that will store any current pending
+ // content updates first.
+ message.clearBody();
+ }
+ }
+
+ private void initializeReading() throws JMSException {
+ checkWriteOnlyBody();
+ if (dataIn == null) {
+ try {
+ Buffer data = message.getPayload();
+ InputStream is = new ByteArrayInputStream(data);
+ length = data.length;
+ dataIn = new DataInputStream(is);
+ } catch (Exception ioe) {
+ throw ExceptionSupport.create(ioe);
+ }
+ }
+ }
+
+ private void storeContent() throws JMSException {
+ if (dataOut != null) {
+ try {
+ dataOut.close();
+ Buffer buffer = bytesOut.toBuffer();
+ message.setPayload(buffer);
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe.getMessage(), ioe);
+ } finally {
+ try {
+ if (bytesOut != null) {
+ bytesOut.close();
+ bytesOut = null;
+ }
+ if (dataOut != null) {
+ dataOut.close();
+ dataOut = null;
+ }
+ } catch (IOException ioe) {
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessage.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessage.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessage.java
new file mode 100644
index 0000000..a2fbd11
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessage.java
@@ -0,0 +1,324 @@
+/**
+ * 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.jms;
+
+import java.util.Enumeration;
+
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.MessageFormatException;
+
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * Wrapper class that provides MapMessage compliant mappings to the OpenWireMapMessage
+ */
+public class OpenWireJMSMapMessage extends OpenWireJMSMessage implements MapMessage {
+
+ private final OpenWireMapMessage message;
+
+ /**
+ * Creates a new instance that wraps a new OpenWireMessage instance.
+ */
+ public OpenWireJMSMapMessage() {
+ this(new OpenWireMapMessage());
+ }
+
+ /**
+ * Creates a new instance that wraps the given OpenWireMessage
+ *
+ * @param message
+ * the OpenWireMessage to wrap.
+ */
+ public OpenWireJMSMapMessage(OpenWireMapMessage message) {
+ this.message = message;
+ }
+
+ @Override
+ public OpenWireJMSMapMessage copy() throws JMSException {
+ OpenWireJMSMapMessage other = new OpenWireJMSMapMessage(message.copy());
+ return other;
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ message.clearBody();
+ }
+
+ @Override
+ public boolean getBoolean(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return false;
+ }
+ if (value instanceof Boolean) {
+ return ((Boolean)value).booleanValue();
+ }
+ if (value instanceof UTF8Buffer) {
+ return Boolean.valueOf(value.toString()).booleanValue();
+ }
+ if (value instanceof String) {
+ return Boolean.valueOf(value.toString()).booleanValue();
+ } else {
+ throw new MessageFormatException(" cannot read a boolean from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public byte getByte(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return 0;
+ } else if (value instanceof Byte) {
+ return ((Byte)value).byteValue();
+ } else if (value instanceof UTF8Buffer) {
+ return Byte.valueOf(value.toString()).byteValue();
+ } else if (value instanceof String) {
+ return Byte.valueOf(value.toString()).byteValue();
+ } else {
+ throw new MessageFormatException(" cannot read a byte from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public short getShort(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return 0;
+ } else if (value instanceof Short) {
+ return ((Short)value).shortValue();
+ } else if (value instanceof Byte) {
+ return ((Byte)value).shortValue();
+ } else if (value instanceof UTF8Buffer) {
+ return Short.valueOf(value.toString()).shortValue();
+ } else if (value instanceof String) {
+ return Short.valueOf(value.toString()).shortValue();
+ } else {
+ throw new MessageFormatException(" cannot read a short from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public char getChar(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ throw new NullPointerException();
+ } else if (value instanceof Character) {
+ return ((Character)value).charValue();
+ } else {
+ throw new MessageFormatException(" cannot read a short from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public int getInt(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return 0;
+ } else if (value instanceof Integer) {
+ return ((Integer)value).intValue();
+ } else if (value instanceof Short) {
+ return ((Short)value).intValue();
+ } else if (value instanceof Byte) {
+ return ((Byte)value).intValue();
+ } else if (value instanceof UTF8Buffer) {
+ return Integer.valueOf(value.toString()).intValue();
+ } else if (value instanceof String) {
+ return Integer.valueOf(value.toString()).intValue();
+ } else {
+ throw new MessageFormatException(" cannot read an int from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public long getLong(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return 0;
+ } else if (value instanceof Long) {
+ return ((Long)value).longValue();
+ } else if (value instanceof Integer) {
+ return ((Integer)value).longValue();
+ } else if (value instanceof Short) {
+ return ((Short)value).longValue();
+ } else if (value instanceof Byte) {
+ return ((Byte)value).longValue();
+ } else if (value instanceof UTF8Buffer) {
+ return Long.valueOf(value.toString()).longValue();
+ } else if (value instanceof String) {
+ return Long.valueOf(value.toString()).longValue();
+ } else {
+ throw new MessageFormatException(" cannot read a long from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public float getFloat(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return 0;
+ } else if (value instanceof Float) {
+ return ((Float)value).floatValue();
+ } else if (value instanceof UTF8Buffer) {
+ return Float.valueOf(value.toString()).floatValue();
+ } else if (value instanceof String) {
+ return Float.valueOf(value.toString()).floatValue();
+ } else {
+ throw new MessageFormatException(" cannot read a float from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public double getDouble(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return 0;
+ } else if (value instanceof Double) {
+ return ((Double)value).doubleValue();
+ } else if (value instanceof Float) {
+ return ((Float)value).floatValue();
+ } else if (value instanceof UTF8Buffer) {
+ return Float.valueOf(value.toString()).floatValue();
+ } else if (value instanceof String) {
+ return Float.valueOf(value.toString()).floatValue();
+ } else {
+ throw new MessageFormatException(" cannot read a double from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public String getString(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value == null) {
+ return null;
+ } else if (value instanceof byte[]) {
+ throw new MessageFormatException("Use getBytes to read a byte array");
+ } else {
+ return value.toString();
+ }
+ }
+
+ @Override
+ public byte[] getBytes(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value instanceof byte[]) {
+ return (byte[])value;
+ } else {
+ throw new MessageFormatException(" cannot read a byte[] from " + value.getClass().getName());
+ }
+ }
+
+ @Override
+ public Object getObject(String name) throws JMSException {
+ Object value = message.getObject(name);
+ if (value instanceof UTF8Buffer) {
+ value = value.toString();
+ }
+
+ return value;
+ }
+
+ @Override
+ public Enumeration<String> getMapNames() throws JMSException {
+ return message.getMapNames();
+ }
+
+ @Override
+ public void setBoolean(String name, boolean value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, value ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ @Override
+ public void setByte(String name, byte value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Byte.valueOf(value));
+ }
+
+ @Override
+ public void setShort(String name, short value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Short.valueOf(value));
+ }
+
+ @Override
+ public void setChar(String name, char value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Character.valueOf(value));
+ }
+
+ @Override
+ public void setInt(String name, int value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Integer.valueOf(value));
+ }
+
+ @Override
+ public void setLong(String name, long value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Long.valueOf(value));
+ }
+
+ @Override
+ public void setFloat(String name, float value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Float.valueOf(value));
+ }
+
+ @Override
+ public void setDouble(String name, double value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, Double.valueOf(value));
+ }
+
+ @Override
+ public void setString(String name, String value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, value);
+ }
+
+ @Override
+ public void setBytes(String name, byte[] value) throws JMSException {
+ checkReadOnlyBody();
+ if (value != null) {
+ message.setObject(name, value);
+ } else {
+ message.removeObject(name);
+ }
+ }
+
+ @Override
+ public void setBytes(String name, byte[] value, int offset, int length) throws JMSException {
+ checkReadOnlyBody();
+ byte[] data = new byte[length];
+ System.arraycopy(value, offset, data, 0, length);
+ message.setObject(name, data);
+ }
+
+ @Override
+ public void setObject(String name, Object value) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(name, value);
+ }
+
+ @Override
+ public boolean itemExists(String name) throws JMSException {
+ return message.itemExists(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMessage.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMessage.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMessage.java
new file mode 100644
index 0000000..a278f37
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSMessage.java
@@ -0,0 +1,561 @@
+/**
+ * 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.jms;
+
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.concurrent.Callable;
+
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.codec.OpenWireConstants;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+import org.apache.activemq.openwire.jms.utils.OpenWireMessagePropertyGetter;
+import org.apache.activemq.openwire.jms.utils.OpenWireMessagePropertySetter;
+import org.apache.activemq.openwire.jms.utils.TypeConversionSupport;
+import org.apache.activemq.openwire.utils.ExceptionSupport;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * A JMS Message implementation that wraps the basic OpenWireMessage instance
+ * to enforce adherence to the JMS specification rules for the javax.jms.Message
+ * type.
+ */
+public class OpenWireJMSMessage implements Message {
+
+ private final OpenWireMessage message;
+
+ private Callable<Void> acknowledgeCallback;
+ private boolean readOnlyBody;
+ private boolean readOnlyProperties;
+
+ /**
+ * Creates a new instance that wraps a new OpenWireMessage instance.
+ */
+ public OpenWireJMSMessage() {
+ this(new OpenWireMessage());
+ }
+
+ /**
+ * Creates a new instance that wraps the given OpenWireMessage
+ *
+ * @param message
+ * the OpenWireMessage to wrap.
+ */
+ public OpenWireJMSMessage(OpenWireMessage message) {
+ this.message = message;
+ }
+
+ /**
+ * Copies this message into a new OpenWireJMSMessage instance.
+ *
+ * @return a new copy of this message and it's contents.
+ *
+ * @throws JMSException if an error occurs during the copy operation.
+ */
+ public OpenWireJMSMessage copy() throws JMSException {
+ OpenWireJMSMessage copy = new OpenWireJMSMessage(message.copy());
+ copy(copy);
+ return copy;
+ }
+
+ protected void copy(OpenWireJMSMessage copy) {
+ copy.readOnlyBody = readOnlyBody;
+ copy.readOnlyProperties = readOnlyProperties;
+ }
+
+ /**
+ * @return the wrapped OpenWireMessage instance.
+ */
+ public OpenWireMessage getOpenWireMessage() {
+ return this.message;
+ }
+
+ @Override
+ public String getJMSMessageID() throws JMSException {
+ return message.getMessageIdAsString();
+ }
+
+ @Override
+ public void setJMSMessageID(String id) throws JMSException {
+ message.setMessageId(id);
+ }
+
+ @Override
+ public long getJMSTimestamp() throws JMSException {
+ return message.getTimestamp();
+ }
+
+ @Override
+ public void setJMSTimestamp(long timestamp) throws JMSException {
+ message.setTimestamp(timestamp);
+ }
+
+ @Override
+ public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
+ return message.getCorrelationIdAsBytes();
+ }
+
+ @Override
+ public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException {
+ message.setCorrelationIdAsBytes(correlationID);
+ }
+
+ @Override
+ public void setJMSCorrelationID(String correlationID) throws JMSException {
+ message.setCorrelationId(correlationID);
+ }
+
+ @Override
+ public String getJMSCorrelationID() throws JMSException {
+ return message.getCorrelationId();
+ }
+
+ @Override
+ public Destination getJMSReplyTo() throws JMSException {
+ return message.getReplyTo();
+ }
+
+ @Override
+ public void setJMSReplyTo(Destination replyTo) throws JMSException {
+ message.setReplyTo(OpenWireDestination.transform(replyTo));
+ }
+
+ @Override
+ public Destination getJMSDestination() throws JMSException {
+ return message.getDestination();
+ }
+
+ @Override
+ public void setJMSDestination(Destination destination) throws JMSException {
+ message.setDestination(OpenWireDestination.transform(destination));
+ }
+
+ @Override
+ public int getJMSDeliveryMode() throws JMSException {
+ return message.isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
+ }
+
+ @Override
+ public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
+ message.setPersistent(deliveryMode == DeliveryMode.PERSISTENT);
+ }
+
+ @Override
+ public boolean getJMSRedelivered() throws JMSException {
+ return message.getRedeliveryCounter() > 0;
+ }
+
+ @Override
+ public void setJMSRedelivered(boolean redelivered) throws JMSException {
+ message.setRedelivered(true);
+ }
+
+ @Override
+ public String getJMSType() throws JMSException {
+ return message.getType();
+ }
+
+ @Override
+ public void setJMSType(String type) throws JMSException {
+ message.setType(type);
+ }
+
+ @Override
+ public long getJMSExpiration() throws JMSException {
+ return message.getExpiration();
+ }
+
+ @Override
+ public void setJMSExpiration(long expiration) throws JMSException {
+ message.setExpiration(expiration);
+ }
+
+ @Override
+ public int getJMSPriority() throws JMSException {
+ return message.getPriority();
+ }
+
+ @Override
+ public void setJMSPriority(int priority) throws JMSException {
+ message.setPriority((byte) priority);
+ }
+
+ @Override
+ public void clearProperties() throws JMSException {
+ message.clearProperties();
+ }
+
+ @Override
+ public boolean propertyExists(String name) throws JMSException {
+ try {
+ return (message.propertyExists(name) || getObjectProperty(name)!= null);
+ } catch (Exception e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ @Override
+ public boolean getBooleanProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+
+ if (value == null) {
+ return false;
+ }
+
+ Boolean rc = (Boolean) TypeConversionSupport.convert(value, Boolean.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a boolean");
+ }
+
+ return rc.booleanValue();
+ }
+
+ @Override
+ public byte getByteProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+ if (value == null) {
+ throw new NumberFormatException("property " + name + " was null");
+ }
+ Byte rc = (Byte) TypeConversionSupport.convert(value, Byte.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a byte");
+ }
+ return rc.byteValue();
+ }
+
+ @Override
+ public short getShortProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+ if (value == null) {
+ throw new NumberFormatException("property " + name + " was null");
+ }
+ Short rc = (Short) TypeConversionSupport.convert(value, Short.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a short");
+ }
+ return rc.shortValue();
+ }
+
+ @Override
+ public int getIntProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+ if (value == null) {
+ throw new NumberFormatException("property " + name + " was null");
+ }
+ Integer rc = (Integer) TypeConversionSupport.convert(value, Integer.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as an integer");
+ }
+ return rc.intValue();
+ }
+
+ @Override
+ public long getLongProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+ if (value == null) {
+ throw new NumberFormatException("property " + name + " was null");
+ }
+ Long rc = (Long) TypeConversionSupport.convert(value, Long.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a long");
+ }
+ return rc.longValue();
+ }
+
+ @Override
+ public float getFloatProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+ if (value == null) {
+ throw new NullPointerException("property " + name + " was null");
+ }
+ Float rc = (Float) TypeConversionSupport.convert(value, Float.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a float");
+ }
+ return rc.floatValue();
+ }
+
+ @Override
+ public double getDoubleProperty(String name) throws JMSException {
+ Object value = getObjectProperty(name);
+ if (value == null) {
+ throw new NullPointerException("property " + name + " was null");
+ }
+ Double rc = (Double) TypeConversionSupport.convert(value, Double.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a double");
+ }
+ return rc.doubleValue();
+ }
+
+ @Override
+ public String getStringProperty(String name) throws JMSException {
+ Object value = null;
+
+ // Always go first to the OpenWire Message field before checking in the
+ // application properties for any other versions.
+ if (name.equals("JMSXUserID")) {
+ value = message.getUserId();
+ if (value == null) {
+ value = getObjectProperty(name);
+ }
+ } else {
+ value = getObjectProperty(name);
+ }
+ if (value == null) {
+ return null;
+ }
+ String rc = (String) TypeConversionSupport.convert(value, String.class);
+ if (rc == null) {
+ throw new MessageFormatException("Property " + name + " was a " + value.getClass().getName() + " and cannot be read as a String");
+ }
+ return rc;
+ }
+
+ @Override
+ public Object getObjectProperty(String name) throws JMSException {
+ if (name == null) {
+ throw new NullPointerException("Property name cannot be null");
+ }
+
+ return OpenWireMessagePropertyGetter.getProperty(message, name);
+ }
+
+ @Override
+ public Enumeration<?> getPropertyNames() throws JMSException {
+ return message.getPropertyNames();
+ }
+
+ /**
+ * return all property names, including standard JMS properties and JMSX properties
+ * @return Enumeration of all property names on this message
+ * @throws JMSException
+ */
+ public Enumeration<String> getAllPropertyNames() throws JMSException {
+ try {
+ Vector<String> result = new Vector<String>(message.getProperties().keySet());
+ result.addAll(OpenWireMessagePropertyGetter.getPropertyNames());
+ return result.elements();
+ } catch (Exception e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+
+ @Override
+ public void setBooleanProperty(String name, boolean value) throws JMSException {
+ setObjectProperty(name, Boolean.valueOf(value), true);
+ }
+
+ @Override
+ public void setByteProperty(String name, byte value) throws JMSException {
+ setObjectProperty(name, Byte.valueOf(value), true);
+ }
+
+ @Override
+ public void setShortProperty(String name, short value) throws JMSException {
+ setObjectProperty(name, Short.valueOf(value), true);
+ }
+
+ @Override
+ public void setIntProperty(String name, int value) throws JMSException {
+ setObjectProperty(name, Integer.valueOf(value), true);
+ }
+
+ @Override
+ public void setLongProperty(String name, long value) throws JMSException {
+ setObjectProperty(name, Long.valueOf(value), true);
+ }
+
+ @Override
+ public void setFloatProperty(String name, float value) throws JMSException {
+ setObjectProperty(name, Float.valueOf(value), true);
+ }
+
+ @Override
+ public void setDoubleProperty(String name, double value) throws JMSException {
+ setObjectProperty(name, Double.valueOf(value), true);
+ }
+
+ @Override
+ public void setStringProperty(String name, String value) throws JMSException {
+ setObjectProperty(name, value, true);
+ }
+
+ @Override
+ public void setObjectProperty(String name, Object value) throws JMSException {
+ setObjectProperty(name, value, true);
+ }
+
+ protected void setObjectProperty(String name, Object value, boolean checkReadOnly) throws JMSException {
+
+ if (checkReadOnly) {
+ checkReadOnlyProperties();
+ }
+
+ if (name == null || name.equals("")) {
+ throw new IllegalArgumentException("Property name cannot be empty or null");
+ }
+
+ if (value instanceof UTF8Buffer) {
+ value = value.toString();
+ }
+
+ // Ensure that message sent with scheduling options comply with the
+ // expected property types for the settings values.
+ value = convertScheduled(name, value);
+
+ OpenWireMessagePropertySetter.setProperty(message, name, value);
+ }
+
+ @Override
+ public void acknowledge() throws JMSException {
+ if (acknowledgeCallback != null) {
+ try {
+ acknowledgeCallback.call();
+ } catch (Exception e) {
+ throw ExceptionSupport.create(e);
+ }
+ }
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ setReadOnlyBody(false);
+ }
+
+ /**
+ * @return the acknowledge callback instance set on this message.
+ */
+ public Callable<Void> getAcknowledgeCallback() {
+ return acknowledgeCallback;
+ }
+
+ /**
+ * Sets the Callable instance that is invoked when the client calls the JMS Message
+ * acknowledge method.
+ *
+ * @param acknowledgeCallback
+ * the acknowledgeCallback to set on this message.
+ */
+ public void setAcknowledgeCallback(Callable<Void> acknowledgeCallback) {
+ this.acknowledgeCallback = acknowledgeCallback;
+ }
+
+ /**
+ * @return true if the body is in read only mode.
+ */
+ public boolean isReadOnlyBody() {
+ return readOnlyBody;
+ }
+
+ /**
+ * @param readOnlyBody
+ * sets if the message body is in read-only mode.
+ */
+ public void setReadOnlyBody(boolean readOnlyBody) {
+ this.readOnlyBody = readOnlyBody;
+ }
+
+ /**
+ * @return true if the message properties are in read-only mode.
+ */
+ public boolean isReadOnlyProperties() {
+ return readOnlyProperties;
+ }
+
+ /**
+ * @param readOnlyProperties
+ * sets if the message properties are in read-only mode.
+ */
+ public void setReadOnlyProperties(boolean readOnlyProperties) {
+ this.readOnlyProperties = readOnlyProperties;
+ }
+
+ /**
+ * @returns true if this message has expired.
+ */
+ public boolean isExpired() {
+ return message.isExpired();
+ }
+
+ /**
+ * @returns true if this message is an Advisory message instance.
+ */
+ public boolean isAdviory() {
+ return this.message.isAdvisory();
+ }
+
+ @Override
+ public int hashCode() {
+ return message.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other == null || other.getClass() != getClass()) {
+ return false;
+ }
+
+ OpenWireJMSMessage jmsMessage = (OpenWireJMSMessage) other;
+
+ return message.equals(jmsMessage.getOpenWireMessage());
+ }
+
+ private void checkReadOnlyProperties() throws MessageNotWriteableException {
+ if (readOnlyProperties) {
+ throw new MessageNotWriteableException("Message properties are read-only");
+ }
+ }
+
+ protected void checkReadOnlyBody() throws MessageNotWriteableException {
+ if (readOnlyBody) {
+ throw new MessageNotWriteableException("Message body is read-only");
+ }
+ }
+
+ protected void checkWriteOnlyBody() throws MessageNotReadableException {
+ if (!readOnlyBody) {
+ throw new MessageNotReadableException("Message body is write-only");
+ }
+ }
+
+ protected Object convertScheduled(String name, Object value) throws MessageFormatException {
+ Object result = value;
+ if (OpenWireConstants.AMQ_SCHEDULED_DELAY.equals(name)){
+ result = TypeConversionSupport.convert(value, Long.class);
+ }
+ else if (OpenWireConstants.AMQ_SCHEDULED_PERIOD.equals(name)){
+ result = TypeConversionSupport.convert(value, Long.class);
+ }
+ else if (OpenWireConstants.AMQ_SCHEDULED_REPEAT.equals(name)){
+ result = TypeConversionSupport.convert(value, Integer.class);
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessage.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessage.java b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessage.java
new file mode 100644
index 0000000..db42806
--- /dev/null
+++ b/openwire-jms/src/main/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessage.java
@@ -0,0 +1,72 @@
+/**
+ * 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.jms;
+
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+/**
+ * Wrapper class that provides ObjectMessage compliant mappings to the OpenWireObjectMessage
+ */
+public class OpenWireJMSObjectMessage extends OpenWireJMSMessage implements ObjectMessage {
+
+ private final OpenWireObjectMessage message;
+
+ /**
+ * Creates a new instance that wraps a new OpenWireMessage instance.
+ */
+ public OpenWireJMSObjectMessage() {
+ this(new OpenWireObjectMessage());
+ }
+
+ /**
+ * Creates a new instance that wraps the given OpenWireMessage
+ *
+ * @param message
+ * the OpenWireMessage to wrap.
+ */
+ public OpenWireJMSObjectMessage(OpenWireObjectMessage message) {
+ this.message = message;
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ super.clearBody();
+ message.clearBody();
+ }
+
+ @Override
+ public OpenWireJMSObjectMessage copy() throws JMSException {
+ OpenWireJMSObjectMessage other = new OpenWireJMSObjectMessage(message.copy());
+ return other;
+ }
+
+ @Override
+ public void setObject(Serializable object) throws JMSException {
+ checkReadOnlyBody();
+ message.setObject(object);
+ }
+
+ @Override
+ public Serializable getObject() throws JMSException {
+ return message.getObject();
+ }
+}
[02/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..e284eab
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataArrayResponseMarshaller.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.v8;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataResponseMarshaller.java
new file mode 100644
index 0000000..92cd359
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v8;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..683a435
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v8;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..6c55ec1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/DiscoveryEventMarshaller.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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..54b432a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/FlushCommandMarshaller.java
new file mode 100644
index 0000000..be9fd4f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..2801cb5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..319ffee
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..46a1a1c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTraceMarshaller.java
new file mode 100644
index 0000000..fb6c1da
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTraceMarshaller.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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..3c41694
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/JournalTransactionMarshaller.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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..eee7026
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..7082d8b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v8;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..dcbf89f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/LocalTransactionIdMarshaller.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.v8;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MarshallerFactory.java
new file mode 100644
index 0000000..495374a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v8;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageAckMarshaller.java
new file mode 100644
index 0000000..f82c276
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/MessageAckMarshaller.java
@@ -0,0 +1,160 @@
+/**
+ * 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.v8;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(tightUnmarsalThrowable(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 {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getPoisonCause(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ tightMarshalThrowable2(wireFormat, info.getPoisonCause(), 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ info.setPoisonCause(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ looseMarshalThrowable(wireFormat, info.getPoisonCause(), dataOut);
+ }
+}
[40/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageIdMarshaller.java
new file mode 100644
index 0000000..f9f2d66
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageMarshaller.java
new file mode 100644
index 0000000..2002de9
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessageMarshaller.java
@@ -0,0 +1,304 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessagePullMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessagePullMarshaller.java
new file mode 100644
index 0000000..5a722d6
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v9;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/NetworkBridgeFilterMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..989ec67
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v9;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBlobMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..8ac12d9
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBytesMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..143b49b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireDestinationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..f470695
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireDestinationMarshaller.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.v9;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMapMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..4ddee53
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..ffe4b5f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireObjectMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..00bd49a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireQueueMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..367a678
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireStreamMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..3ab8536
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempDestinationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..1795d2f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v9;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempQueueMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..21a4ea7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempTopicMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..e403e02
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTextMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..8a003e7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v9/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v9;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[47/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempDestinationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..6c52a5e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,87 @@
+/**
+ * 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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempQueueMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..333faa1
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempTopicMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..c2838c7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTextMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..89c132b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTopicMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..5685b16
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireTopicMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/PartialCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/PartialCommandMarshaller.java
new file mode 100644
index 0000000..c6b891c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerIdMarshaller.java
new file mode 100644
index 0000000..9368623
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerIdMarshaller.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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..6a9d16f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ProducerInfoMarshaller.java
@@ -0,0 +1,156 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..985bf0e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveInfoMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveSubscriptionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..913b2b2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/RemoveSubscriptionInfoMarshaller.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.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ReplayCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..9f752b5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ReplayCommandMarshaller.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.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ResponseMarshaller.java
new file mode 100644
index 0000000..bc48008
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionIdMarshaller.java
new file mode 100644
index 0000000..1132a8e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionIdMarshaller.java
@@ -0,0 +1,130 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, 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/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionInfoMarshaller.java
new file mode 100644
index 0000000..e789944
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SessionInfoMarshaller.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.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ShutdownInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..b86fdb7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SubscriptionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..0eab1a0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/SubscriptionInfoMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionIdMarshaller.java
new file mode 100644
index 0000000..b0291e5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..8373ec8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/TransactionInfoMarshaller.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.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
[20/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..80616fe
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..e7e34d3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTextMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..0a5543f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..67d2b37
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/PartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/PartialCommandMarshaller.java
new file mode 100644
index 0000000..452bbab
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerAckMarshaller.java
new file mode 100644
index 0000000..af280f6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerIdMarshaller.java
new file mode 100644
index 0000000..b07d6df
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerIdMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..5dfb8d7
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..bb9b597
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveInfoMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveSubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..7dde0fe
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v3;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ReplayCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..409fdce
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ResponseMarshaller.java
new file mode 100644
index 0000000..a1da21a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ResponseMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionIdMarshaller.java
new file mode 100644
index 0000000..87cc76a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionIdMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionInfoMarshaller.java
new file mode 100644
index 0000000..db921c5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SessionInfoMarshaller.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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ShutdownInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..2b7c601
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..1eb64b7
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionIdMarshaller.java
new file mode 100644
index 0000000..feadb29
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v3;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[26/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..8e78096
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/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.v2;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..c797b6c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ConsumerInfoMarshaller.java
@@ -0,0 +1,223 @@
+/**
+ * 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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ControlCommandMarshaller.java
new file mode 100644
index 0000000..4947b58
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v2;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..b7c8bac
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataArrayResponseMarshaller.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.v2;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataResponseMarshaller.java
new file mode 100644
index 0000000..ef812e4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v2;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..e2596e6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v2;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..d0eda02
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/DiscoveryEventMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..8ca2e00
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/FlushCommandMarshaller.java
new file mode 100644
index 0000000..46cf783
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..fc405b2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..99f3623
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..09818ce
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTraceMarshaller.java
new file mode 100644
index 0000000..8228b63
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTraceMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..2edfd4e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/JournalTransactionMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..887e361
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..0c9b9c4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[34/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ExceptionSupport.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ExceptionSupport.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ExceptionSupport.java
new file mode 100644
index 0000000..3f113b1
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ExceptionSupport.java
@@ -0,0 +1,103 @@
+/**
+ * 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.utils;
+
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+
+/**
+ * Exception support class.
+ *
+ * Factory class for creating JMSException instances based on String messages or by
+ * wrapping other non-JMS exception.
+ *
+ * @since 1.0
+ */
+public final class ExceptionSupport {
+
+ private ExceptionSupport() {}
+
+ public static JMSException create(String msg, Throwable cause) {
+ JMSException exception = new JMSException(msg);
+ exception.initCause(cause);
+ return exception;
+ }
+
+ public static JMSException create(String msg, Exception cause) {
+ JMSException exception = new JMSException(msg);
+ exception.setLinkedException(cause);
+ exception.initCause(cause);
+ return exception;
+ }
+
+ public static JMSException create(Throwable cause) {
+ if (cause instanceof JMSException) {
+ return (JMSException) cause;
+ }
+ if (cause.getCause() instanceof JMSException) {
+ return (JMSException) cause.getCause();
+ }
+
+ String msg = cause.getMessage();
+ if (msg == null || msg.length() == 0) {
+ msg = cause.toString();
+ }
+ JMSException exception = new JMSException(msg);
+ exception.initCause(cause);
+ return exception;
+ }
+
+ public static JMSException create(Exception cause) {
+ if (cause instanceof JMSException) {
+ return (JMSException) cause;
+ }
+ if (cause.getCause() instanceof JMSException) {
+ return (JMSException) cause.getCause();
+ }
+
+ String msg = cause.getMessage();
+ if (msg == null || msg.length() == 0) {
+ msg = cause.toString();
+ }
+ JMSException exception = new JMSException(msg);
+ exception.setLinkedException(cause);
+ exception.initCause(cause);
+ return exception;
+ }
+
+ public static MessageEOFException createMessageEOFException(Exception cause) {
+ String msg = cause.getMessage();
+ if (msg == null || msg.length() == 0) {
+ msg = cause.toString();
+ }
+ MessageEOFException exception = new MessageEOFException(msg);
+ exception.setLinkedException(cause);
+ exception.initCause(cause);
+ return exception;
+ }
+
+ public static MessageFormatException createMessageFormatException(Throwable cause) {
+ String msg = cause.getMessage();
+ if (msg == null || msg.length() == 0) {
+ msg = cause.toString();
+ }
+ MessageFormatException exception = new MessageFormatException(msg);
+ exception.initCause(cause);
+ return exception;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ObjectMessageInputStream.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ObjectMessageInputStream.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ObjectMessageInputStream.java
new file mode 100644
index 0000000..c6164a7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/ObjectMessageInputStream.java
@@ -0,0 +1,150 @@
+/**
+ * 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.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ObjectMessageInputStream extends ObjectInputStream {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ObjectMessageInputStream.class);
+ private static final ClassLoader FALLBACK_CLASS_LOADER = ObjectMessageInputStream.class.getClassLoader();
+
+ private final ClassLoader inLoader;
+
+ public ObjectMessageInputStream(InputStream in) throws IOException {
+ super(in);
+ inLoader = in.getClass().getClassLoader();
+ }
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ return load(classDesc.getName(), cl, inLoader);
+ }
+
+ @Override
+ protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class<?>[] cinterfaces = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++) {
+ cinterfaces[i] = load(interfaces[i], cl);
+ }
+
+ try {
+ return Proxy.getProxyClass(cl, cinterfaces);
+ } catch (IllegalArgumentException e) {
+ try {
+ return Proxy.getProxyClass(inLoader, cinterfaces);
+ } catch (IllegalArgumentException e1) {
+ // ignore
+ }
+ try {
+ return Proxy.getProxyClass(FALLBACK_CLASS_LOADER, cinterfaces);
+ } catch (IllegalArgumentException e2) {
+ // ignore
+ }
+
+ throw new ClassNotFoundException(null, e);
+ }
+ }
+
+ private Class<?> load(String className, ClassLoader... cl) throws ClassNotFoundException {
+ // check for simple types first
+ final Class<?> clazz = loadSimpleType(className);
+ if (clazz != null) {
+ LOG.trace("Loaded class: {} as simple type -> ", className, clazz);
+ return clazz;
+ }
+
+ // try the different class loaders
+ for (ClassLoader loader : cl) {
+ LOG.trace("Attempting to load class: {} using classloader: {}", className, cl);
+ try {
+ Class<?> answer = Class.forName(className, false, loader);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Loaded class: {} using classloader: {} -> ", new Object[] { className, cl, answer });
+ }
+ return answer;
+ } catch (ClassNotFoundException e) {
+ LOG.trace("Class not found: {} using classloader: {}", className, cl);
+ // ignore
+ }
+ }
+
+ // and then the fallback class loader
+ return Class.forName(className, false, FALLBACK_CLASS_LOADER);
+ }
+
+ /**
+ * Load a simple type
+ *
+ * @param name
+ * the name of the class to load
+ * @return the class or <tt>null</tt> if it could not be loaded
+ */
+ public static Class<?> loadSimpleType(String name) {
+ if ("java.lang.byte[]".equals(name) || "byte[]".equals(name)) {
+ return byte[].class;
+ } else if ("java.lang.Byte[]".equals(name) || "Byte[]".equals(name)) {
+ return Byte[].class;
+ } else if ("java.lang.Object[]".equals(name) || "Object[]".equals(name)) {
+ return Object[].class;
+ } else if ("java.lang.String[]".equals(name) || "String[]".equals(name)) {
+ return String[].class;
+ // and these is common as well
+ } else if ("java.lang.String".equals(name) || "String".equals(name)) {
+ return String.class;
+ } else if ("java.lang.Boolean".equals(name) || "Boolean".equals(name)) {
+ return Boolean.class;
+ } else if ("boolean".equals(name)) {
+ return boolean.class;
+ } else if ("java.lang.Integer".equals(name) || "Integer".equals(name)) {
+ return Integer.class;
+ } else if ("int".equals(name)) {
+ return int.class;
+ } else if ("java.lang.Long".equals(name) || "Long".equals(name)) {
+ return Long.class;
+ } else if ("long".equals(name)) {
+ return long.class;
+ } else if ("java.lang.Short".equals(name) || "Short".equals(name)) {
+ return Short.class;
+ } else if ("short".equals(name)) {
+ return short.class;
+ } else if ("java.lang.Byte".equals(name) || "Byte".equals(name)) {
+ return Byte.class;
+ } else if ("byte".equals(name)) {
+ return byte.class;
+ } else if ("java.lang.Float".equals(name) || "Float".equals(name)) {
+ return Float.class;
+ } else if ("float".equals(name)) {
+ return float.class;
+ } else if ("java.lang.Double".equals(name) || "Double".equals(name)) {
+ return Double.class;
+ } else if ("double".equals(name)) {
+ return double.class;
+ }
+
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConnection.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConnection.java
new file mode 100644
index 0000000..cc3edc4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConnection.java
@@ -0,0 +1,156 @@
+/**
+ * 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.utils;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.activemq.openwire.commands.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.ConsumerId;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+/**
+ * Encapsulates an ActiveMQ compatible OpenWire connection Id used to create instance
+ * of ConnectionId objects and provides methods for creating OpenWireSession instances
+ * that are children of this Connection.
+ */
+public class OpenWireConnection extends ConnectionInfo {
+
+ private static final OpenWireIdGenerator idGenerator = new OpenWireIdGenerator();
+
+ private SessionId connectionSessionId;
+
+ private final AtomicLong sessionIdGenerator = new AtomicLong(1);
+ private final AtomicLong consumerIdGenerator = new AtomicLong(1);
+ private final AtomicLong tempDestinationIdGenerator = new AtomicLong(1);
+ private final AtomicLong localTransactionIdGenerator = new AtomicLong(1);
+
+ /**
+ * Creates a fixed OpenWire Connection Id instance.
+ */
+ public OpenWireConnection() {
+ this(idGenerator.generateId());
+ }
+
+ /**
+ * Creates a fixed OpenWire Connection Id instance.
+ *
+ * @param connectionId
+ * the set ConnectionId value that this class will use to seed new Session IDs.
+ */
+ public OpenWireConnection(String connectionId) {
+ this.connectionId = new ConnectionId(connectionId);
+ }
+
+ /**
+ * Creates a fixed OpenWire Connection Id instance.
+ *
+ * @param connectionId
+ * the set ConnectionId value that this class will use to seed new Session IDs.
+ */
+ public OpenWireConnection(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ @Override
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ /**
+ * @return the SessionId used for the internal Connection Session instance.
+ */
+ public SessionId getConnectionSessionId() {
+ if (this.connectionSessionId == null) {
+ synchronized (this) {
+ if (this.connectionSessionId == null) {
+ this.connectionSessionId = new SessionId(connectionId, -1);
+ }
+ }
+ }
+
+ return this.connectionSessionId;
+ }
+
+ /**
+ * Creates a new SessionId for a Session instance that is rooted by this Connection
+ *
+ * @return the next logical SessionId for this ConnectionId instance.
+ */
+ public SessionId getNextSessionId() {
+ return new SessionId(connectionId, sessionIdGenerator.getAndIncrement());
+ }
+
+ /**
+ * Creates a new Transaction ID used for local transactions created from this Connection.
+ *
+ * @return a new TransactionId instance.
+ */
+ public TransactionId getNextLocalTransactionId() {
+ return new LocalTransactionId(connectionId, localTransactionIdGenerator.getAndIncrement());
+ }
+
+ /**
+ * Create a new Consumer Id for ConnectionConsumer instances.
+ *
+ * @returns a new ConsumerId valid for use in ConnectionConsumer instances.
+ */
+ public ConsumerId getNextConnectionConsumerId() {
+ return new ConsumerId(getConnectionSessionId(), consumerIdGenerator.getAndIncrement());
+ }
+
+ /**
+ * Creates a new Temporary Destination name based on the Connection ID.
+ *
+ * @returns a new String destination name used to create temporary destinations.
+ */
+ public String getNextTemporaryDestinationName() {
+ return connectionId.getValue() + ":" + tempDestinationIdGenerator.getAndIncrement();
+ }
+
+ /**
+ * Factory method for creating a ConnectionInfo command that contains the connection
+ * ID from this OpenWireConnection instance.
+ *
+ * @return a new ConnectionInfo that contains the proper connection Id.
+ */
+ public ConnectionInfo createConnectionInfo() {
+ return this.copy();
+ }
+
+ /**
+ * Factory method for creating a suitable RemoveInfo command that can be used to remove
+ * this connection from a Broker.
+ *
+ * @return a new RemoveInfo that properly references this connection's Id.
+ */
+ public RemoveInfo createRemoveInfo() {
+ return new RemoveInfo(getConnectionId());
+ }
+
+ /**
+ * Factory method for OpenWireSession instances
+ *
+ * @return a new OpenWireSession with the next logical session ID for this connection.
+ */
+ public OpenWireSession createOpenWireSession() {
+ return new OpenWireSession(connectionId, sessionIdGenerator.getAndIncrement());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConsumer.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConsumer.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConsumer.java
new file mode 100644
index 0000000..19c53ff
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireConsumer.java
@@ -0,0 +1,108 @@
+/**
+ * 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.utils;
+
+import org.apache.activemq.openwire.commands.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+/**
+ * Encapsulates an ActiveMQ compatible MessageConsumer ID using an OpenWire
+ * ConsumerId generated from a parent Session instance.
+ */
+public class OpenWireConsumer extends ConsumerInfo {
+
+ private final OpenWireSession parent;
+
+ /**
+ * Creates a new OpenWireConsumer instance with the assigned consumerId.
+ *
+ * @param parent
+ * the OpenWireSession that created this instance.
+ * @param consumerId
+ * the assigned consumer Id for this Consumer.
+ */
+ public OpenWireConsumer(OpenWireSession parent, ConsumerId consumerId) {
+ super(consumerId);
+ this.parent = parent;
+ }
+
+ /**
+ * Creates a new OpenWireConsumer from the given ConsumerInfo instance.
+ *
+ * @param parent
+ * the OpenWireSession that created this instance.
+ * @param consumerInfo
+ * the ConsumerInfo instance used to populate this one.
+ */
+ public OpenWireConsumer(OpenWireSession parent, ConsumerInfo consumerInfo) {
+ this.parent = parent;
+ consumerInfo.copy(this);
+ }
+
+ /**
+ * @return the parent OpenWireSessionId instance.
+ */
+ public OpenWireSession getParent() {
+ return parent;
+ }
+
+ /**
+ * @return the next logical delivery Id for messages dispatched by the consumer.
+ */
+ public long getNextDeliveryId() {
+ return parent.getNextDeliveryId();
+ }
+
+ @Override
+ public String toString() {
+ return consumerId.toString();
+ }
+
+ /**
+ * Factory method for creating a ConsumerInfo to wrap this instance's ConsumerId.
+ *
+ * @return a new ConsumerInfo instance that can be used to register a remote Consumer.
+ */
+ public ConsumerInfo createConsumerInfo() {
+ return this.copy();
+ }
+
+ /**
+ * Factory method for creating a ConsumerInfo to wrap this instance's ConsumerId.
+ *
+ * @param destination
+ * the target destination for this ProducerInfo instance.
+ *
+ * @return a new ConsumerInfo instance that can be used to register a remote Consumer.
+ */
+ public ConsumerInfo createConsumerInfo(OpenWireDestination destination) {
+ this.setDestination(destination);
+ return this.copy();
+ }
+
+ /**
+ * Factory method for creating a RemoveInfo command that can be used to remove this
+ * consumer instance from the Broker.
+ *
+ * @return a new RemoveInfo instance that can remove this consumer.
+ */
+ public RemoveInfo createRemoveInfo() {
+ return new RemoveInfo(getConsumerId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireIdGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireIdGenerator.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireIdGenerator.java
new file mode 100644
index 0000000..6af2d20
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireIdGenerator.java
@@ -0,0 +1,250 @@
+/**
+ * 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.utils;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Generator for Globally unique Strings.
+ */
+public class OpenWireIdGenerator {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireIdGenerator.class);
+ private static final String UNIQUE_STUB;
+ private static int instanceCount;
+ private static String hostName;
+
+ private String seed;
+ private final AtomicLong sequence = new AtomicLong(1);
+ private int length;
+
+ public static final String PROPERTY_IDGENERATOR_PORT = "activemq.idgenerator.port";
+
+ static {
+ String stub = "";
+ boolean canAccessSystemProps = true;
+ try {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPropertiesAccess();
+ }
+ } catch (SecurityException se) {
+ canAccessSystemProps = false;
+ }
+
+ if (canAccessSystemProps) {
+ int idGeneratorPort = 0;
+ ServerSocket ss = null;
+ try {
+ idGeneratorPort = Integer.parseInt(System.getProperty(PROPERTY_IDGENERATOR_PORT, "0"));
+ LOG.trace("Using port {}", idGeneratorPort);
+ hostName = getLocalHostName();
+ ss = new ServerSocket(idGeneratorPort);
+ stub = "-" + ss.getLocalPort() + "-" + System.currentTimeMillis() + "-";
+ Thread.sleep(100);
+ } catch (Exception e) {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("could not generate unique stub by using DNS and binding to local port", e);
+ } else {
+ LOG.warn("could not generate unique stub by using DNS and binding to local port: {} {}", e.getClass().getCanonicalName(), e.getMessage());
+ }
+
+ // Restore interrupted state so higher level code can deal with
+ // it.
+ if (e instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
+ }
+ } finally {
+ if (ss != null) {
+ try {
+ ss.close();
+ } catch (IOException ioe) {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Closing the server socket failed", ioe);
+ } else {
+ LOG.warn("Closing the server socket failed" + " due " + ioe.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ if (hostName == null) {
+ hostName = "localhost";
+ }
+
+ hostName = sanitizeHostName(hostName);
+
+ if (stub.length() == 0) {
+ stub = "-1-" + System.currentTimeMillis() + "-";
+ }
+ UNIQUE_STUB = stub;
+ }
+
+ /**
+ * Construct an IdGenerator
+ */
+ public OpenWireIdGenerator(String prefix) {
+ synchronized (UNIQUE_STUB) {
+ this.seed = prefix + UNIQUE_STUB + (instanceCount++) + ":";
+ this.length = this.seed.length() + ("" + Long.MAX_VALUE).length();
+ }
+ }
+
+ public OpenWireIdGenerator() {
+ this("ID:" + hostName);
+ }
+
+ /**
+ * As we have to find the hostname as a side-affect of generating a unique
+ * stub, we allow it's easy retrieval here
+ *
+ * @return the local host name
+ */
+ public static String getHostName() {
+ return hostName;
+ }
+
+ /**
+ * Generate a unique id
+ *
+ * @return a unique id
+ */
+ public synchronized String generateId() {
+ StringBuilder sb = new StringBuilder(length);
+ sb.append(seed);
+ sb.append(sequence.getAndIncrement());
+ return sb.toString();
+ }
+
+ public static String sanitizeHostName(String hostName) {
+ boolean changed = false;
+
+ StringBuilder sb = new StringBuilder();
+ for (char ch : hostName.toCharArray()) {
+ // only include ASCII chars
+ if (ch < 127) {
+ sb.append(ch);
+ } else {
+ changed = true;
+ }
+ }
+
+ if (changed) {
+ String newHost = sb.toString();
+ LOG.info("Sanitized hostname from: {} to: {}", hostName, newHost);
+ return newHost;
+ } else {
+ return hostName;
+ }
+ }
+
+ /**
+ * Generate a unique ID - that is friendly for a URL or file system
+ *
+ * @return a unique id
+ */
+ public String generateSanitizedId() {
+ String result = generateId();
+ result = result.replace(':', '-');
+ result = result.replace('_', '-');
+ result = result.replace('.', '-');
+ return result;
+ }
+
+ /**
+ * From a generated id - return the seed (i.e. minus the count)
+ *
+ * @param id
+ * the generated identifier
+ * @return the seed
+ */
+ public static String getSeedFromId(String id) {
+ String result = id;
+ if (id != null) {
+ int index = id.lastIndexOf(':');
+ if (index > 0 && (index + 1) < id.length()) {
+ result = id.substring(0, index);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * From a generated id - return the generator count
+ *
+ * @param id
+ * @return the count
+ */
+ public static long getSequenceFromId(String id) {
+ long result = -1;
+ if (id != null) {
+ int index = id.lastIndexOf(':');
+
+ if (index > 0 && (index + 1) < id.length()) {
+ String numStr = id.substring(index + 1, id.length());
+ result = Long.parseLong(numStr);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Does a proper compare on the IDs
+ *
+ * @param id1
+ * @param id2
+ *
+ * @return 0 if equal else a positive if id1 is > id2 ...
+ */
+ public static int compare(String id1, String id2) {
+ int result = -1;
+ String seed1 = OpenWireIdGenerator.getSeedFromId(id1);
+ String seed2 = OpenWireIdGenerator.getSeedFromId(id2);
+ if (seed1 != null && seed2 != null) {
+ result = seed1.compareTo(seed2);
+ if (result == 0) {
+ long count1 = OpenWireIdGenerator.getSequenceFromId(id1);
+ long count2 = OpenWireIdGenerator.getSequenceFromId(id2);
+ result = (int) (count1 - count2);
+ }
+ }
+ return result;
+ }
+
+ private static String getLocalHostName() throws UnknownHostException {
+ try {
+ return (InetAddress.getLocalHost()).getHostName();
+ } catch (UnknownHostException uhe) {
+ String host = uhe.getMessage(); // host = "hostname: hostname"
+ if (host != null) {
+ int colon = host.indexOf(':');
+ if (colon > 0) {
+ return host.substring(0, colon);
+ }
+ }
+ throw uhe;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupport.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupport.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupport.java
new file mode 100644
index 0000000..4189d12
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupport.java
@@ -0,0 +1,439 @@
+/**
+ * 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.utils;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.UTFDataFormatException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * The fixed version of the UTF8 encoding function. Some older JVM's UTF8
+ * encoding function breaks when handling large strings.
+ */
+public final class OpenWireMarshallingSupport {
+
+ public static final byte NULL = 0;
+ public static final byte BOOLEAN_TYPE = 1;
+ public static final byte BYTE_TYPE = 2;
+ public static final byte CHAR_TYPE = 3;
+ public static final byte SHORT_TYPE = 4;
+ public static final byte INTEGER_TYPE = 5;
+ public static final byte LONG_TYPE = 6;
+ public static final byte DOUBLE_TYPE = 7;
+ public static final byte FLOAT_TYPE = 8;
+ public static final byte STRING_TYPE = 9;
+ public static final byte BYTE_ARRAY_TYPE = 10;
+ public static final byte MAP_TYPE = 11;
+ public static final byte LIST_TYPE = 12;
+ public static final byte BIG_STRING_TYPE = 13;
+
+ private OpenWireMarshallingSupport() {
+ }
+
+ public static void marshalPrimitiveMap(Map<String, Object> map, DataOutput out) throws IOException {
+ if (map == null) {
+ out.writeInt(-1);
+ } else {
+ out.writeInt(map.size());
+ for (String name : map.keySet()) {
+ out.writeUTF(name);
+ Object value = map.get(name);
+ marshalPrimitive(out, value);
+ }
+ }
+ }
+
+ public static Map<String, Object> unmarshalPrimitiveMap(DataInput in) throws IOException {
+ return unmarshalPrimitiveMap(in, Integer.MAX_VALUE);
+ }
+
+ public static Map<String, Object> unmarshalPrimitiveMap(DataInput in, boolean force) throws IOException {
+ return unmarshalPrimitiveMap(in, Integer.MAX_VALUE, force);
+ }
+
+ public static Map<String, Object> unmarshalPrimitiveMap(DataInput in, int maxPropertySize) throws IOException {
+ return unmarshalPrimitiveMap(in, maxPropertySize, false);
+ }
+
+ /**
+ * @param in
+ * @return
+ * @throws IOException
+ * @throws IOException
+ */
+ public static Map<String, Object> unmarshalPrimitiveMap(DataInput in, int maxPropertySize, boolean force) throws IOException {
+ int size = in.readInt();
+ if (size > maxPropertySize) {
+ throw new IOException("Primitive map is larger than the allowed size: " + size);
+ }
+ if (size < 0) {
+ return null;
+ } else {
+ Map<String, Object> rc = new HashMap<String, Object>(size);
+ for (int i = 0; i < size; i++) {
+ String name = in.readUTF();
+ rc.put(name, unmarshalPrimitive(in, force));
+ }
+ return rc;
+ }
+ }
+
+ public static void marshalPrimitiveList(List<Object> list, DataOutput out) throws IOException {
+ out.writeInt(list.size());
+ for (Object element : list) {
+ marshalPrimitive(out, element);
+ }
+ }
+
+ public static List<Object> unmarshalPrimitiveList(DataInput in) throws IOException {
+ return unmarshalPrimitiveList(in, false);
+ }
+
+ public static List<Object> unmarshalPrimitiveList(DataInput in, boolean force) throws IOException {
+ int size = in.readInt();
+ List<Object> answer = new ArrayList<Object>(size);
+ while (size-- > 0) {
+ answer.add(unmarshalPrimitive(in, force));
+ }
+ return answer;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void marshalPrimitive(DataOutput out, Object value) throws IOException {
+ if (value == null) {
+ marshalNull(out);
+ } else if (value.getClass() == Boolean.class) {
+ marshalBoolean(out, ((Boolean) value).booleanValue());
+ } else if (value.getClass() == Byte.class) {
+ marshalByte(out, ((Byte) value).byteValue());
+ } else if (value.getClass() == Character.class) {
+ marshalChar(out, ((Character) value).charValue());
+ } else if (value.getClass() == Short.class) {
+ marshalShort(out, ((Short) value).shortValue());
+ } else if (value.getClass() == Integer.class) {
+ marshalInt(out, ((Integer) value).intValue());
+ } else if (value.getClass() == Long.class) {
+ marshalLong(out, ((Long) value).longValue());
+ } else if (value.getClass() == Float.class) {
+ marshalFloat(out, ((Float) value).floatValue());
+ } else if (value.getClass() == Double.class) {
+ marshalDouble(out, ((Double) value).doubleValue());
+ } else if (value.getClass() == byte[].class) {
+ marshalByteArray(out, (byte[]) value);
+ } else if (value.getClass() == String.class) {
+ marshalString(out, (String) value);
+ } else if (value.getClass() == UTF8Buffer.class) {
+ marshalString(out, value.toString());
+ } else if (value instanceof Map) {
+ out.writeByte(MAP_TYPE);
+ marshalPrimitiveMap((Map<String, Object>) value, out);
+ } else if (value instanceof List) {
+ out.writeByte(LIST_TYPE);
+ marshalPrimitiveList((List<Object>) value, out);
+ } else {
+ throw new IOException("Object is not a primitive: " + value);
+ }
+ }
+
+ public static Object unmarshalPrimitive(DataInput in) throws IOException {
+ return unmarshalPrimitive(in, false);
+ }
+
+ public static Object unmarshalPrimitive(DataInput in, boolean force) throws IOException {
+ Object value = null;
+ byte type = in.readByte();
+ switch (type) {
+ case BYTE_TYPE:
+ value = Byte.valueOf(in.readByte());
+ break;
+ case BOOLEAN_TYPE:
+ value = in.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
+ break;
+ case CHAR_TYPE:
+ value = Character.valueOf(in.readChar());
+ break;
+ case SHORT_TYPE:
+ value = Short.valueOf(in.readShort());
+ break;
+ case INTEGER_TYPE:
+ value = Integer.valueOf(in.readInt());
+ break;
+ case LONG_TYPE:
+ value = Long.valueOf(in.readLong());
+ break;
+ case FLOAT_TYPE:
+ value = new Float(in.readFloat());
+ break;
+ case DOUBLE_TYPE:
+ value = new Double(in.readDouble());
+ break;
+ case BYTE_ARRAY_TYPE:
+ value = new byte[in.readInt()];
+ in.readFully((byte[]) value);
+ break;
+ case STRING_TYPE:
+ if (force) {
+ value = in.readUTF();
+ } else {
+ value = readUTF(in, in.readUnsignedShort());
+ }
+ break;
+ case BIG_STRING_TYPE: {
+ if (force) {
+ value = readUTF8(in);
+ } else {
+ value = readUTF(in, in.readInt());
+ }
+ break;
+ }
+ case MAP_TYPE:
+ value = unmarshalPrimitiveMap(in, true);
+ break;
+ case LIST_TYPE:
+ value = unmarshalPrimitiveList(in, true);
+ break;
+ case NULL:
+ value = null;
+ break;
+ default:
+ throw new IOException("Unknown primitive type: " + type);
+ }
+ return value;
+ }
+
+ public static UTF8Buffer readUTF(DataInput in, int length) throws IOException {
+ byte data[] = new byte[length];
+ in.readFully(data);
+ return new UTF8Buffer(data);
+ }
+
+ public static void marshalNull(DataOutput out) throws IOException {
+ out.writeByte(NULL);
+ }
+
+ public static void marshalBoolean(DataOutput out, boolean value) throws IOException {
+ out.writeByte(BOOLEAN_TYPE);
+ out.writeBoolean(value);
+ }
+
+ public static void marshalByte(DataOutput out, byte value) throws IOException {
+ out.writeByte(BYTE_TYPE);
+ out.writeByte(value);
+ }
+
+ public static void marshalChar(DataOutput out, char value) throws IOException {
+ out.writeByte(CHAR_TYPE);
+ out.writeChar(value);
+ }
+
+ public static void marshalShort(DataOutput out, short value) throws IOException {
+ out.writeByte(SHORT_TYPE);
+ out.writeShort(value);
+ }
+
+ public static void marshalInt(DataOutput out, int value) throws IOException {
+ out.writeByte(INTEGER_TYPE);
+ out.writeInt(value);
+ }
+
+ public static void marshalLong(DataOutput out, long value) throws IOException {
+ out.writeByte(LONG_TYPE);
+ out.writeLong(value);
+ }
+
+ public static void marshalFloat(DataOutput out, float value) throws IOException {
+ out.writeByte(FLOAT_TYPE);
+ out.writeFloat(value);
+ }
+
+ public static void marshalDouble(DataOutput out, double value) throws IOException {
+ out.writeByte(DOUBLE_TYPE);
+ out.writeDouble(value);
+ }
+
+ public static void marshalByteArray(DataOutput out, byte[] value) throws IOException {
+ marshalByteArray(out, value, 0, value.length);
+ }
+
+ public static void marshalByteArray(DataOutput out, byte[] value, int offset, int length) throws IOException {
+ out.writeByte(BYTE_ARRAY_TYPE);
+ out.writeInt(length);
+ out.write(value, offset, length);
+ }
+
+ public static void marshalString(DataOutput out, String s) throws IOException {
+ // If it's too big, out.writeUTF may not able able to write it out.
+ if (s.length() < Short.MAX_VALUE / 4) {
+ out.writeByte(STRING_TYPE);
+ out.writeUTF(s);
+ } else {
+ out.writeByte(BIG_STRING_TYPE);
+ writeUTF8(out, s);
+ }
+ }
+
+ public static void writeUTF8(DataOutput dataOut, String text) throws IOException {
+ if (text != null) {
+ int strlen = text.length();
+ int utflen = 0;
+ char[] charr = new char[strlen];
+ int c = 0;
+ int count = 0;
+
+ text.getChars(0, strlen, charr, 0);
+
+ for (int i = 0; i < strlen; i++) {
+ c = charr[i];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ utflen++;
+ } else if (c > 0x07FF) {
+ utflen += 3;
+ } else {
+ utflen += 2;
+ }
+ }
+ // TODO diff: Sun code - removed
+ byte[] bytearr = new byte[utflen + 4]; // TODO diff: Sun code
+ bytearr[count++] = (byte) ((utflen >>> 24) & 0xFF); // TODO diff:
+ // Sun code
+ bytearr[count++] = (byte) ((utflen >>> 16) & 0xFF); // TODO diff:
+ // Sun code
+ bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF);
+ bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF);
+ for (int i = 0; i < strlen; i++) {
+ c = charr[i];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ bytearr[count++] = (byte) c;
+ } else if (c > 0x07FF) {
+ bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
+ bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F));
+ bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
+ } else {
+ bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
+ bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
+ }
+ }
+ dataOut.write(bytearr);
+
+ } else {
+ dataOut.writeInt(-1);
+ }
+ }
+
+ public static String readUTF8(DataInput dataIn) throws IOException {
+ int utflen = dataIn.readInt(); // TODO diff: Sun code
+ if (utflen > -1) {
+ StringBuffer str = new StringBuffer(utflen);
+ byte bytearr[] = new byte[utflen];
+ int c;
+ int char2;
+ int char3;
+ int count = 0;
+
+ dataIn.readFully(bytearr, 0, utflen);
+
+ while (count < utflen) {
+ c = bytearr[count] & 0xff;
+ switch (c >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ /* 0xxxxxxx */
+ count++;
+ str.append((char) c);
+ break;
+ case 12:
+ case 13:
+ /* 110x xxxx 10xx xxxx */
+ count += 2;
+ if (count > utflen) {
+ throw new UTFDataFormatException();
+ }
+ char2 = bytearr[count - 1];
+ if ((char2 & 0xC0) != 0x80) {
+ throw new UTFDataFormatException();
+ }
+ str.append((char) (((c & 0x1F) << 6) | (char2 & 0x3F)));
+ break;
+ case 14:
+ /* 1110 xxxx 10xx xxxx 10xx xxxx */
+ count += 3;
+ if (count > utflen) {
+ throw new UTFDataFormatException();
+ }
+ char2 = bytearr[count - 2]; // TODO diff: Sun code
+ char3 = bytearr[count - 1]; // TODO diff: Sun code
+ if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) {
+ throw new UTFDataFormatException();
+ }
+ str.append((char) (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)));
+ break;
+ default:
+ /* 10xx xxxx, 1111 xxxx */
+ throw new UTFDataFormatException();
+ }
+ }
+ // The number of chars produced may be less than utflen
+ return new String(str);
+ } else {
+ return null;
+ }
+ }
+
+ public static String propertiesToString(Properties props) throws IOException {
+ String result = "";
+ if (props != null) {
+ DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream();
+ props.store(dataOut, "");
+ result = new String(dataOut.getData(), 0, dataOut.size());
+ dataOut.close();
+ }
+ return result;
+ }
+
+ public static Properties stringToProperties(String str) throws IOException {
+ Properties result = new Properties();
+ if (str != null && str.length() > 0) {
+ DataByteArrayInputStream dataIn = new DataByteArrayInputStream(str.getBytes());
+ result.load(dataIn);
+ dataIn.close();
+ }
+ return result;
+ }
+
+ public static String truncate64(String text) {
+ if (text.length() > 63) {
+ text = text.substring(0, 45) + "..." + text.substring(text.length() - 12);
+ }
+ return text;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireProducer.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireProducer.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireProducer.java
new file mode 100644
index 0000000..5952c2f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireProducer.java
@@ -0,0 +1,123 @@
+/**
+ * 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.utils;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+import org.apache.activemq.openwire.commands.SessionId;
+
+/**
+ * Encapsulates an ActiveMQ compatible OpenWire Producer ID and provides
+ * functionality used to generate message IDs for the producer.
+ */
+public class OpenWireProducer extends ProducerInfo {
+
+ private final OpenWireSession parent;
+
+ private final AtomicLong messageSequence = new AtomicLong(1);
+
+ /**
+ * Creates a new instance with the given parent Session Id and assigned Producer Id
+ *
+ * @param parent
+ * the OpenWireSessionId that is the parent of the new Producer.
+ * @param producerId
+ * the ProducerId assigned to this instance.
+ */
+ public OpenWireProducer(OpenWireSession parent, ProducerId producerId) {
+ super(producerId);
+ this.parent = parent;
+ }
+
+ /**
+ * Creates a new instance with the given parent Session Id and copy the given ProducerInfo
+ *
+ * @param parent
+ * the OpenWireSessionId that is the parent of the new Producer.
+ * @param producerInfo
+ * the ProducerInfo used to populate this instance.
+ */
+ public OpenWireProducer(OpenWireSession parent, ProducerInfo producerInfo) {
+ this.parent = parent;
+ producerInfo.copy(this);
+ }
+
+ /**
+ * @return the SessionId of this ProducerId instance.
+ */
+ public SessionId getSessionId() {
+ return this.parent.getSessionId();
+ }
+
+ /**
+ * @return the parent OpenWireSessionId
+ */
+ public OpenWireSession getParent() {
+ return parent;
+ }
+
+ /**
+ * Factory method used to simplify creation of MessageIds from this Producer
+ *
+ * @return the next logical MessageId for the producer this instance represents.
+ */
+ public MessageId getNextMessageId() {
+ return new MessageId(producerId, messageSequence.getAndIncrement());
+ }
+
+ @Override
+ public String toString() {
+ return producerId.toString();
+ }
+
+ /**
+ * Factory method for creating a ProducerInfo to wrap this instance's ProducerId.
+ *
+ * @return a new ProducerInfo instance that can be used to register a remote producer.
+ */
+ public ProducerInfo createProducerInfo() {
+ return this.copy();
+ }
+
+ /**
+ * Factory method for creating a ProducerInfo to wrap this instance's ProducerId.
+ *
+ * @param destination
+ * the target destination for this ProducerInfo instance.
+ *
+ * @return a new ProducerInfo instance that can be used to register a remote producer.
+ */
+ public ProducerInfo createProducerInfo(OpenWireDestination destination) {
+ this.setDestination(destination);
+ return this.copy();
+ }
+
+ /**
+ * Factory method for creating a RemoveInfo command that can be used to remove this
+ * producer instance from the Broker.
+ *
+ * @return a new RemoveInfo instance that can remove this producer.
+ */
+ public RemoveInfo createRemoveInfo() {
+ return new RemoveInfo(getProducerId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireSession.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireSession.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireSession.java
new file mode 100644
index 0000000..1830dc4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireSession.java
@@ -0,0 +1,130 @@
+/**
+ * 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.utils;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.activemq.openwire.commands.ConnectionId;
+import org.apache.activemq.openwire.commands.ConsumerId;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+/**
+ * Encapsulates an ActiveMQ compatible OpenWire Session ID and provides methods
+ * for creating consumer and producer ID objects that are children of this session.
+ */
+public class OpenWireSession extends SessionInfo {
+
+ private final AtomicLong consumerIdGenerator = new AtomicLong(1);
+ private final AtomicLong producerIdGenerator = new AtomicLong(1);
+ private final AtomicLong deliveryIdGenerator = new AtomicLong(1);
+
+ /**
+ * Creates a new OpenWireSessionId instance with the given ID.
+ *
+ * @param sessionId
+ * the SessionId assigned to this instance.
+ */
+ public OpenWireSession(SessionId sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Creates a new OpenWireSessionId instance based on the given ConnectionId
+ * and a session sequence number.
+ *
+ * @param connectionId
+ * the ConnectionId to use for this Session ID.
+ * @param sequence
+ * the sequence number that identifies this Session instance.
+ */
+ public OpenWireSession(ConnectionId connectionId, long sequence) {
+ this(new SessionId(connectionId, sequence));
+ }
+
+ /**
+ * @return the fixed SessionId of this OpenWireSessionId instance.
+ */
+ @Override
+ public SessionId getSessionId() {
+ return sessionId;
+ }
+
+ /**
+ * @return the next ConsumerId instance for the managed SessionId.
+ */
+ public ConsumerId getNextConsumerId() {
+ return new ConsumerId(sessionId, consumerIdGenerator.getAndIncrement());
+ }
+
+ /**
+ * @return the next ProducerId instance for the managed SessionId.
+ */
+ public ProducerId getNextProducerId() {
+ return new ProducerId(sessionId, producerIdGenerator.getAndIncrement());
+ }
+
+ /**
+ * @return the next Id to assign incoming message deliveries from the managed session Id.
+ */
+ public long getNextDeliveryId() {
+ return this.deliveryIdGenerator.getAndIncrement();
+ }
+
+ @Override
+ public String toString() {
+ return sessionId.toString();
+ }
+
+ /**
+ * Factory method used to create OpenWireConsumerId instances from this Session.
+ *
+ * @returns an OpenWireConsumerId rooted at this SessionId.
+ */
+ public OpenWireConsumer createOpenWireConsumer() {
+ return new OpenWireConsumer(this, getNextConsumerId());
+ }
+
+ /**
+ * Factory method used to create OpenWireProducerId instances from this Session.
+ *
+ * @returns an OpenWireProducerId rooted at this SessionId.
+ */
+ public OpenWireProducer createOpenWireProducer() {
+ return new OpenWireProducer(this, getNextProducerId());
+ }
+
+ /**
+ * Factory method for creating a SessionInfo to wrap the managed SessionId
+ *
+ * @returns a SessionInfo object that wraps the internal SessionId.
+ */
+ public SessionInfo createSessionInfo() {
+ return new SessionInfo(getSessionId());
+ }
+
+ /**
+ * Factory method for creating a suitable RemoveInfo for this session instance.
+ *
+ * @return a new RemoveInfo instance that can be used to remove this session.
+ */
+ public RemoveInfo createRemoveInfo() {
+ return new RemoveInfo(getSessionId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/UnresolvedDestinationTransformer.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/UnresolvedDestinationTransformer.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/UnresolvedDestinationTransformer.java
new file mode 100644
index 0000000..252c758
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/UnresolvedDestinationTransformer.java
@@ -0,0 +1,57 @@
+/**
+ * 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.utils;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+/**
+ * Allows for the configuration of a user defined Destination transformer that will
+ * be called when it cannot be logically determined what type of Destination is
+ * being converted to an OpenWireDestination. This can happen for instance when a
+ * JMS Provider's Destination implements both Topic and Queue from the same root
+ * Destination object.
+ */
+public interface UnresolvedDestinationTransformer {
+
+ /**
+ * Given the JMS Destination convert it to the correct OpenWire destination
+ *
+ * @param destination
+ * the foreign destination to convert to the proper OpenWire type.
+ *
+ * @return an OpenWireDestination instance of the correct type.
+ *
+ * @throws JMSException if an error occurs while converting the Destination type.
+ */
+ public OpenWireDestination transform(Destination destination) throws JMSException;
+
+ /**
+ * Given the name of a JMS Destination convert it to the correct OpenWire destination.
+ *
+ * @param destination
+ * the name of a destination to convert to the proper OpenWire type.
+ *
+ * @return an OpenWireDestination instance of the correct type.
+ *
+ * @throws JMSException if an error occurs while converting the Destination type.
+ */
+ public OpenWireDestination transform(String destination) throws JMSException;
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/codec/BooleanStreamTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/codec/BooleanStreamTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/codec/BooleanStreamTest.java
new file mode 100644
index 0000000..0bfb4c3
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/codec/BooleanStreamTest.java
@@ -0,0 +1,156 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test for the OpenWire BooleanStream class.
+ */
+public class BooleanStreamTest {
+
+ protected OpenWireFormat openWireformat;
+ protected int endOfStreamMarker = 0x12345678;
+ int numberOfBytes = 8 * 200;
+
+ interface BooleanValueSet {
+ boolean getBooleanValueFor(int index, int count);
+ }
+
+ @Test
+ public void testBooleanMarshallingUsingAllTrue() throws Exception {
+ testBooleanStream(numberOfBytes, new BooleanValueSet() {
+ @Override
+ public boolean getBooleanValueFor(int index, int count) {
+ return true;
+ }
+ });
+ }
+
+ @Test
+ public void testBooleanMarshallingUsingAllFalse() throws Exception {
+ testBooleanStream(numberOfBytes, new BooleanValueSet() {
+ @Override
+ public boolean getBooleanValueFor(int index, int count) {
+ return false;
+ }
+ });
+ }
+
+ @Test
+ public void testBooleanMarshallingUsingOddAlternateTrueFalse() throws Exception {
+ testBooleanStream(numberOfBytes, new BooleanValueSet() {
+ @Override
+ public boolean getBooleanValueFor(int index, int count) {
+ return (index & 1) == 0;
+ }
+ });
+ }
+
+ @Test
+ public void testBooleanMarshallingUsingEvenAlternateTrueFalse() throws Exception {
+ testBooleanStream(numberOfBytes, new BooleanValueSet() {
+ @Override
+ public boolean getBooleanValueFor(int index, int count) {
+ return (index & 1) != 0;
+ }
+ });
+ }
+
+ protected void testBooleanStream(int numberOfBytes, BooleanValueSet valueSet) throws Exception {
+ for (int i = 0; i < numberOfBytes; i++) {
+ try {
+ assertMarshalBooleans(i, valueSet);
+ } catch (Throwable e) {
+ throw (AssertionFailedError) new AssertionFailedError("Iteration failed at: " + i).initCause(e);
+ }
+ }
+ }
+
+ protected void assertMarshalBooleans(int count, BooleanValueSet valueSet) throws Exception {
+ BooleanStream bs = new BooleanStream();
+ for (int i = 0; i < count; i++) {
+ bs.writeBoolean(valueSet.getBooleanValueFor(i, count));
+ }
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ DataOutputStream ds = new DataOutputStream(buffer);
+ bs.marshal(ds);
+ ds.writeInt(endOfStreamMarker);
+
+ // now lets read from the stream
+ ds.close();
+
+ ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray());
+ DataInputStream dis = new DataInputStream(in);
+ bs = new BooleanStream();
+ try {
+ bs.unmarshal(dis);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to unmarshal: " + count + " booleans: " + e);
+ }
+
+ for (int i = 0; i < count; i++) {
+ boolean expected = valueSet.getBooleanValueFor(i, count);
+ try {
+ boolean actual = bs.readBoolean();
+ assertEquals("value of object: " + i + " was: " + actual, expected, actual);
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Failed to parse boolean: " + i + " out of: " + count + " due to: " + e);
+ }
+ }
+ int marker = dis.readInt();
+ assertEquals("Marker int when unmarshalling: " + count + " booleans", Integer.toHexString(endOfStreamMarker), Integer.toHexString(marker));
+
+ // lets try read and we should get an exception
+ try {
+ dis.readByte();
+ fail("Should have reached the end of the stream");
+ } catch (IOException e) {
+ // worked!
+ }
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ openWireformat = createOpenWireFormat();
+ }
+
+ protected OpenWireFormat createOpenWireFormat() {
+ OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION);
+ wf.setCacheEnabled(true);
+ wf.setStackTraceEnabled(false);
+ wf.setVersion(1);
+ return wf;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/codec/NumberRangesWhileMarshallingTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/codec/NumberRangesWhileMarshallingTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/codec/NumberRangesWhileMarshallingTest.java
new file mode 100644
index 0000000..8ce0303
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/codec/NumberRangesWhileMarshallingTest.java
@@ -0,0 +1,146 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NumberRangesWhileMarshallingTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(NumberRangesWhileMarshallingTest.class);
+
+ protected String connectionId = "Cheese";
+ protected ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ protected DataOutputStream ds = new DataOutputStream(buffer);
+ protected OpenWireFormat openWireformat;
+ protected int endOfStreamMarker = 0x12345678;
+
+ @Test
+ public void testLongNumberRanges() throws Exception {
+ long[] numberValues = {
+ // bytes
+ 0, 1, 0x7e, 0x7f, 0x80, 0x81, 0xf0, 0xff,
+ // shorts
+ 0x7eff, 0x7fffL, 0x8001L, 0x8000L, 0xe000L, 0xe0001L, 0xff00L, 0xffffL,
+ // ints
+ 0x10000L, 0x700000L, 0x12345678L, 0x72345678L, 0x7fffffffL, 0x80000000L, 0x80000001L, 0xE0000001L, 0xFFFFFFFFL,
+ // 3 byte longs
+ 0x123456781L, 0x1234567812L, 0x12345678123L, 0x123456781234L, 0x1234567812345L, 0x12345678123456L, 0x7e345678123456L, 0x7fffffffffffffL,
+ 0x80000000000000L, 0x80000000000001L, 0xe0000000000001L, 0xffffffffffffffL,
+ // 4 byte longs
+ 0x1234567812345678L, 0x7fffffffffffffffL, 0x8000000000000000L, 0x8000000000000001L, 0xe000000000000001L, 0xffffffffffffffffL, 1 };
+
+ for (int i = 0; i < numberValues.length; i++) {
+ long value = numberValues[i];
+
+ SessionId object = new SessionId();
+ object.setConnectionId(connectionId);
+ object.setValue(value);
+ writeObject(object);
+ }
+ ds.writeInt(endOfStreamMarker);
+
+ // now lets read from the stream
+ ds.close();
+
+ ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray());
+ DataInputStream dis = new DataInputStream(in);
+ for (int i = 0; i < numberValues.length; i++) {
+ long value = numberValues[i];
+ String expected = Long.toHexString(value);
+ LOG.info("Unmarshaling value: " + i + " = " + expected);
+
+ SessionId command = (SessionId) openWireformat.unmarshal(dis);
+ assertEquals("connection ID in object: " + i, connectionId, command.getConnectionId());
+ String actual = Long.toHexString(command.getValue());
+ assertEquals("value of object: " + i + " was: " + actual, expected, actual);
+ }
+ int marker = dis.readInt();
+ assertEquals("Marker int", Integer.toHexString(endOfStreamMarker), Integer.toHexString(marker));
+
+ // lets try read and we should get an exception
+ try {
+ byte value = dis.readByte();
+ fail("Should have reached the end of the stream: " + value);
+ } catch (IOException e) {
+ // worked!
+ }
+ }
+
+ @Test
+ public void testMaxFrameSize() throws Exception {
+ OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION);
+ wf.setMaxFrameSize(10);
+ OpenWireTextMessage msg = new OpenWireTextMessage();
+ msg.setText("This is a test");
+
+ writeObject(msg);
+ ds.writeInt(endOfStreamMarker);
+
+ // now lets read from the stream
+ ds.close();
+
+ ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray());
+ DataInputStream dis = new DataInputStream(in);
+
+ try {
+ wf.unmarshal(dis);
+ } catch (IOException ioe) {
+ return;
+ }
+
+ fail("Should fail because of the large frame size");
+ }
+
+ @Test
+ public void testDefaultMaxFrameSizeUnlimited() {
+ OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION);
+ assertEquals(Long.MAX_VALUE, wf.getMaxFrameSize());
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ openWireformat = createOpenWireFormat();
+ }
+
+ protected OpenWireFormat createOpenWireFormat() {
+ OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION);
+ wf.setCacheEnabled(true);
+ wf.setStackTraceEnabled(false);
+ wf.setVersion(1);
+ return wf;
+ }
+
+ private void writeObject(Object object) throws IOException {
+ openWireformat.marshal(object, ds);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/DataStructureTestSupport.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/DataStructureTestSupport.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/DataStructureTestSupport.java
new file mode 100644
index 0000000..286fa22
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/DataStructureTestSupport.java
@@ -0,0 +1,143 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+import junit.framework.AssertionFailedError;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.Command;
+import org.fusesource.hawtbuf.Buffer;
+import org.junit.Before;
+
+public abstract class DataStructureTestSupport {
+
+ protected boolean cacheEnabled;
+ protected OpenWireFormat wireFormat;
+
+ public void assertBeanMarshalls(Object original) throws IOException {
+ Object o = marshalAndUnmarshall(original, wireFormat);
+ assertNotNull(o);
+ assertEquals(original, o);
+ }
+
+ public static void assertEquals(Object expect, Object was) {
+ if (expect == null ^ was == null) {
+ throw new AssertionFailedError("Not equals, expected: " + expect + ", was: " + was);
+ }
+
+ if (expect == null) {
+ return;
+ }
+
+ if (expect.getClass() != was.getClass()) {
+ throw new AssertionFailedError("Not equals, classes don't match. expected: " + expect.getClass() + ", was: " + was.getClass());
+ }
+
+ if (expect.getClass().isArray()) {
+ Class<?> componentType = expect.getClass().getComponentType();
+ if (componentType.isPrimitive()) {
+ boolean ok = false;
+ if (componentType == byte.class) {
+ ok = Arrays.equals((byte[]) expect, (byte[]) was);
+ }
+ if (componentType == char.class) {
+ ok = Arrays.equals((char[]) expect, (char[]) was);
+ }
+ if (componentType == short.class) {
+ ok = Arrays.equals((short[]) expect, (short[]) was);
+ }
+ if (componentType == int.class) {
+ ok = Arrays.equals((int[]) expect, (int[]) was);
+ }
+ if (componentType == long.class) {
+ ok = Arrays.equals((long[]) expect, (long[]) was);
+ }
+ if (componentType == double.class) {
+ ok = Arrays.equals((double[]) expect, (double[]) was);
+ }
+ if (componentType == float.class) {
+ ok = Arrays.equals((float[]) expect, (float[]) was);
+ }
+ if (!ok) {
+ throw new AssertionFailedError("Arrays not equal");
+ }
+ } else {
+ Object expectArray[] = (Object[]) expect;
+ Object wasArray[] = (Object[]) was;
+ if (expectArray.length != wasArray.length) {
+ throw new AssertionFailedError("Not equals, array lengths don't match. expected: " + expectArray.length + ", was: " + wasArray.length);
+ }
+ for (int i = 0; i < wasArray.length; i++) {
+ assertEquals(expectArray[i], wasArray[i]);
+ }
+
+ }
+ } else if (expect instanceof Command) {
+ assertEquals(expect.getClass(), was.getClass());
+ Method[] methods = expect.getClass().getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ if ((method.getName().startsWith("get") || method.getName().startsWith("is")) && method.getParameterTypes().length == 0
+ && method.getReturnType() != null) {
+
+ // Check to see if there is a setter for the method.
+ try {
+ if (method.getName().startsWith("get")) {
+ expect.getClass().getMethod(method.getName().replaceFirst("get", "set"), new Class[] { method.getReturnType() });
+ } else {
+ expect.getClass().getMethod(method.getName().replaceFirst("is", "set"), new Class[] { method.getReturnType() });
+ }
+ } catch (Throwable ignore) {
+ continue;
+ }
+
+ try {
+ assertEquals(method.invoke(expect, (Object) null), method.invoke(was, (Object) null));
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
+ } catch (InvocationTargetException e) {
+ }
+ }
+ }
+ } else {
+ org.junit.Assert.assertEquals(expect, was);
+ }
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ wireFormat = createWireFormat();
+ }
+
+ protected OpenWireFormat createWireFormat() {
+ OpenWireFormat answer = new OpenWireFormat(10);
+ answer.setCacheEnabled(cacheEnabled);
+ return answer;
+ }
+
+ protected Object marshalAndUnmarshall(Object original, OpenWireFormat wireFormat) throws IOException {
+ Buffer packet = wireFormat.marshal(original);
+ return wireFormat.unmarshal(packet);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/MessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/MessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/MessageTest.java
new file mode 100644
index 0000000..8e3494a
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/MessageTest.java
@@ -0,0 +1,112 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(value = Parameterized.class)
+public class MessageTest extends DataStructureTestSupport {
+
+ public MessageTest(Boolean cacheEnabled) {
+ this.cacheEnabled = cacheEnabled;
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() {
+ Object[][] data = new Object[][] { { Boolean.TRUE }, { Boolean.FALSE } };
+ return Arrays.asList(data);
+ }
+
+ @Test
+ public void testOpenWireMessageMarshaling() throws IOException {
+ OpenWireMessage message = new OpenWireMessage();
+ message.setCommandId((short)1);
+ message.setOriginalDestination(new OpenWireQueue("queue"));
+ message.setGroupID("group");
+ message.setGroupSequence(4);
+ message.setCorrelationId("correlation");
+ message.setMessageId(new MessageId("c1:1:1", 1));
+ assertBeanMarshalls(message);
+ }
+
+ @Test
+ public void testOpenWireMessageMarshalingBigMessageId() throws IOException {
+ OpenWireMessage message = new OpenWireMessage();
+ message.setCommandId((short)1);
+ message.setOriginalDestination(new OpenWireQueue("queue"));
+ message.setGroupID("group");
+ message.setGroupSequence(4);
+ message.setCorrelationId("correlation");
+ message.setMessageId(new MessageId("c1:1:1", Short.MAX_VALUE));
+ assertBeanMarshalls(message);
+ }
+
+ @Test
+ public void testOpenWireMessageMarshalingBiggerMessageId() throws IOException {
+ OpenWireMessage message = new OpenWireMessage();
+ message.setCommandId((short)1);
+ message.setOriginalDestination(new OpenWireQueue("queue"));
+ message.setGroupID("group");
+ message.setGroupSequence(4);
+ message.setCorrelationId("correlation");
+ message.setMessageId(new MessageId("c1:1:1", Integer.MAX_VALUE));
+ assertBeanMarshalls(message);
+ }
+
+ @Test
+ public void testOpenWireMessageMarshalingBiggestMessageId() throws IOException {
+ OpenWireMessage message = new OpenWireMessage();
+ message.setCommandId((short)1);
+ message.setOriginalDestination(new OpenWireQueue("queue"));
+ message.setGroupID("group");
+ message.setGroupSequence(4);
+ message.setCorrelationId("correlation");
+ message.setMessageId(new MessageId("c1:1:1", Long.MAX_VALUE));
+ assertBeanMarshalls(message);
+ }
+
+ @Test
+ public void testMessageIdMarshaling() throws IOException {
+ assertBeanMarshalls(new MessageId("c1:1:1", 1));
+ }
+
+ @Test
+ public void testPropRemove() throws Exception {
+ OpenWireMessage message = new OpenWireMessage();
+ message.setProperty("RM","RM");
+
+ OpenWireMessage unMarshalled = (OpenWireMessage) marshalAndUnmarshall(message, wireFormat);
+
+ unMarshalled.getProperty("NA");
+ unMarshalled.removeProperty("RM");
+
+ OpenWireMessage unMarshalledAgain = (OpenWireMessage) marshalAndUnmarshall(unMarshalled, wireFormat);
+ assertNull("Prop is gone", unMarshalledAgain.getProperty("RM"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireBytesMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireBytesMessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireBytesMessageTest.java
new file mode 100644
index 0000000..88af005
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireBytesMessageTest.java
@@ -0,0 +1,76 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+import org.junit.Test;
+
+public class OpenWireBytesMessageTest {
+
+ // The following text should compress well
+ private static final String TEXT = "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. ";
+
+ @Test
+ public void testGetDataStructureType() {
+ OpenWireBytesMessage msg = new OpenWireBytesMessage();
+ assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_BYTES_MESSAGE);
+ }
+
+ @Test
+ public void testGetBodyLength() throws Exception {
+ OpenWireBytesMessage msg = new OpenWireBytesMessage();
+
+ byte[] data = new byte[80];
+
+ for (byte i = 0; i < data.length; i++) {
+ data[i] = i;
+ }
+
+ msg.setBodyBytes(data);
+
+ assertTrue(msg.getBodyLength() == 80);
+ }
+
+ @Test
+ public void testBodyCompression() throws Exception {
+ OpenWireBytesMessage message = new OpenWireBytesMessage();
+ message.setUseCompression(true);
+ message.setBodyBytes(TEXT.getBytes("UTF8"));
+
+ int compressedSize = message.getContent().getLength();
+ byte[] bytes = message.getBodyBytes();
+
+ assertTrue(compressedSize < bytes.length);
+
+ String rcvString = new String(bytes, "UTF8");
+ assertEquals(TEXT.length(), rcvString.length());
+ assertEquals(TEXT, rcvString);
+ assertTrue(message.isCompressed());
+ }
+}
\ No newline at end of file
[33/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireDestinationTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireDestinationTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireDestinationTest.java
new file mode 100644
index 0000000..e69eaf8
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireDestinationTest.java
@@ -0,0 +1,135 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.Topic;
+
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+import org.junit.Test;
+
+/**
+ * Test various usages of the OpenWireDestination and its subclasses.
+ */
+public class OpenWireDestinationTest {
+
+ @Test
+ public void testSorting() throws Exception {
+ SortedSet<OpenWireDestination> set = new TreeSet<OpenWireDestination>();
+ OpenWireDestination[] destinations = {new OpenWireQueue("A"), new OpenWireQueue("B"),
+ new OpenWireTopic("A"), new OpenWireTopic("B")};
+ List<OpenWireDestination> expected = Arrays.asList(destinations);
+ set.addAll(expected);
+ List<OpenWireDestination> actual = new ArrayList<OpenWireDestination>(set);
+ assertEquals("Sorted order", expected, actual);
+ }
+
+ class CombyDest implements Queue, Topic, TemporaryQueue, TemporaryTopic {
+
+ private final String qName;
+ private final String topicName;
+
+ public CombyDest(String qName, String topicName) {
+ this.qName = qName;
+ this.topicName = topicName;
+ }
+
+ @Override
+ public void delete() throws JMSException {}
+
+ @Override
+ public String getTopicName() throws JMSException {
+ return topicName;
+ }
+
+ @Override
+ public String getQueueName() throws JMSException {
+ return qName;
+ }
+ }
+
+ @Test
+ public void testTransformPollymorphic() throws Exception {
+ OpenWireQueue queue = new OpenWireQueue("TEST");
+ assertEquals(OpenWireDestination.transform(queue), queue);
+ assertTrue("is a q", OpenWireDestination.transform(new CombyDest(null, "Topic")) instanceof OpenWireTopic);
+ assertTrue("is a q", OpenWireDestination.transform(new CombyDest("Q", null)) instanceof OpenWireQueue);
+ try {
+ OpenWireDestination.transform(new CombyDest(null, null));
+ fail("expect ex as cannot disambiguate");
+ } catch (JMSException expected) {
+ }
+ try {
+ OpenWireDestination.transform(new CombyDest("Q", "T"));
+ fail("expect ex as cannot disambiguate");
+ } catch (JMSException expected) {
+ }
+ }
+
+ @Test
+ public void testEmptyQueueName() {
+ try {
+ new OpenWireQueue("");
+ fail("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ @Test
+ public void testEmptyTopicName() {
+ try {
+ new OpenWireTopic("");
+ fail("Should have thrown IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ @Test
+ public void testDestinationOptions() throws Exception {
+ doTestDestinationOptions(new OpenWireQueue("TEST?k1=v1&k2=v2"));
+ doTestDestinationOptions(new OpenWireTopic("TEST?k1=v1&k2=v2"));
+ doTestDestinationOptions(new OpenWireTempQueue("TEST:1?k1=v1&k2=v2"));
+ doTestDestinationOptions(new OpenWireTempTopic("TEST:1?k1=v1&k2=v2"));
+ }
+
+ private void doTestDestinationOptions(OpenWireDestination destination) throws IOException {
+ Map<String, String> options = destination.getOptions();
+ assertNotNull(options);
+ assertEquals("v1", options.get("k1"));
+ assertEquals("v2", options.get("k2"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMapMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMapMessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMapMessageTest.java
new file mode 100644
index 0000000..0a7e66a
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMapMessageTest.java
@@ -0,0 +1,211 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OpenWireMapMessageTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireMapMessageTest.class);
+
+ @Rule
+ public TestName name = new TestName();
+
+ @Test
+ public void testBytesConversion() throws JMSException, IOException {
+ OpenWireMapMessage msg = new OpenWireMapMessage();
+ msg.setObject("boolean", true);
+ msg.setObject("byte", (byte) 1);
+ msg.setObject("bytes", new byte[1]);
+ msg.setObject("char", 'a');
+ msg.setObject("double", 1.5);
+ msg.setObject("float", 1.5f);
+ msg.setObject("int", 1);
+ msg.setObject("long", 1L);
+ msg.setObject("object", "stringObj");
+ msg.setObject("short", (short) 1);
+ msg.setObject("string", "string");
+
+ // Test with a 1Meg String
+ StringBuffer bigSB = new StringBuffer(1024 * 1024);
+ for (int i = 0; i < 1024 * 1024; i++) {
+ bigSB.append('a' + i % 26);
+ }
+ String bigString = bigSB.toString();
+
+ msg.setObject("bigString", bigString);
+
+ msg = (OpenWireMapMessage) msg.copy();
+
+ assertEquals(msg.getObject("boolean"), true);
+ assertEquals(msg.getObject("byte"), (byte) 1);
+ assertEquals(((byte[]) msg.getObject("bytes")).length, 1);
+ assertEquals(msg.getObject("char"), 'a');
+ assertEquals((Double) msg.getObject("double"), 1.5, 0);
+ assertEquals((Float) msg.getObject("float"), 1.5f, 0);
+ assertEquals(msg.getObject("int"), 1);
+ assertEquals(msg.getObject("long"), 1L);
+ assertEquals(msg.getObject("object"), "stringObj");
+ assertEquals(msg.getObject("short"), (short) 1);
+ assertEquals(msg.getObject("string"), "string");
+ assertEquals(msg.getObject("bigString"), bigString);
+ }
+
+ @Test
+ public void testGetObject() throws JMSException {
+ OpenWireMapMessage msg = new OpenWireMapMessage();
+ Boolean booleanValue = Boolean.TRUE;
+ Byte byteValue = Byte.valueOf("1");
+ byte[] bytesValue = new byte[3];
+ Character charValue = new Character('a');
+ Double doubleValue = Double.valueOf("1.5");
+ Float floatValue = Float.valueOf("1.5");
+ Integer intValue = Integer.valueOf("1");
+ Long longValue = Long.valueOf("1");
+ Short shortValue = Short.valueOf("1");
+ String stringValue = "string";
+
+ try {
+ msg.setObject("boolean", booleanValue);
+ msg.setObject("byte", byteValue);
+ msg.setObject("bytes", bytesValue);
+ msg.setObject("char", charValue);
+ msg.setObject("double", doubleValue);
+ msg.setObject("float", floatValue);
+ msg.setObject("int", intValue);
+ msg.setObject("long", longValue);
+ msg.setObject("short", shortValue);
+ msg.setObject("string", stringValue);
+ } catch (MessageFormatException mfe) {
+ LOG.warn("Caught: " + mfe);
+ mfe.printStackTrace();
+ fail("object formats should be correct");
+ }
+
+ msg = (OpenWireMapMessage) msg.copy();
+
+ assertTrue(msg.getObject("boolean") instanceof Boolean);
+ assertEquals(msg.getObject("boolean"), booleanValue);
+ assertTrue(msg.getObject("byte") instanceof Byte);
+ assertEquals(msg.getObject("byte"), byteValue);
+ assertTrue(msg.getObject("bytes") instanceof byte[]);
+ assertEquals(((byte[]) msg.getObject("bytes")).length, bytesValue.length);
+ assertEquals(((byte[])msg.getObject("bytes")).length, bytesValue.length);
+ assertTrue(msg.getObject("char") instanceof Character);
+ assertEquals(msg.getObject("char"), charValue);
+ assertTrue(msg.getObject("double") instanceof Double);
+ assertEquals(msg.getObject("double"), doubleValue);
+ assertTrue(msg.getObject("float") instanceof Float);
+ assertEquals(msg.getObject("float"), floatValue);
+ assertTrue(msg.getObject("int") instanceof Integer);
+ assertEquals(msg.getObject("int"), intValue);
+ assertTrue(msg.getObject("long") instanceof Long);
+ assertEquals(msg.getObject("long"), longValue);
+ assertTrue(msg.getObject("short") instanceof Short);
+ assertEquals(msg.getObject("short"), shortValue);
+ assertTrue(msg.getObject("string") instanceof String);
+ assertEquals(msg.getObject("string"), stringValue);
+
+ msg.clearBody();
+ try {
+ msg.setObject("object", new Object());
+ fail("should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testGetMapNames() throws JMSException {
+ OpenWireMapMessage msg = new OpenWireMapMessage();
+ msg.setObject("boolean", true);
+ msg.setObject("byte", (byte) 1);
+ msg.setObject("bytes1", new byte[1]);
+ msg.setObject("char", 'a');
+ msg.setObject("double", 1.5);
+ msg.setObject("float", 1.5f);
+ msg.setObject("int", 1);
+ msg.setObject("long", 1);
+ msg.setObject("object", "stringObj");
+ msg.setObject("short", (short) 1);
+ msg.setObject("string", "string");
+
+ msg = (OpenWireMapMessage) msg.copy();
+
+ Enumeration<String> mapNamesEnum = msg.getMapNames();
+ List<String> mapNamesList = Collections.list(mapNamesEnum);
+
+ assertEquals(mapNamesList.size(), 11);
+ assertTrue(mapNamesList.contains("boolean"));
+ assertTrue(mapNamesList.contains("byte"));
+ assertTrue(mapNamesList.contains("bytes1"));
+ assertTrue(mapNamesList.contains("char"));
+ assertTrue(mapNamesList.contains("double"));
+ assertTrue(mapNamesList.contains("float"));
+ assertTrue(mapNamesList.contains("int"));
+ assertTrue(mapNamesList.contains("long"));
+ assertTrue(mapNamesList.contains("object"));
+ assertTrue(mapNamesList.contains("short"));
+ assertTrue(mapNamesList.contains("string"));
+ }
+
+ @Test
+ public void testItemExists() throws JMSException {
+ OpenWireMapMessage mapMessage = new OpenWireMapMessage();
+
+ mapMessage.setObject("exists", "test");
+
+ mapMessage = (OpenWireMapMessage) mapMessage.copy();
+
+ assertTrue(mapMessage.itemExists("exists"));
+ assertFalse(mapMessage.itemExists("doesntExist"));
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireMapMessage mapMessage = new OpenWireMapMessage();
+ mapMessage.setObject("String", "String");
+ mapMessage.clearBody();
+
+ mapMessage.setContent(mapMessage.getContent());
+ assertNull(mapMessage.getObject("String"));
+ mapMessage.clearBody();
+ mapMessage.setObject("String", "String");
+
+ mapMessage = (OpenWireMapMessage) mapMessage.copy();
+
+ mapMessage.getObject("String");
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMessageTest.java
new file mode 100644
index 0000000..b6263c7
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMessageTest.java
@@ -0,0 +1,461 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+import org.fusesource.hawtbuf.Buffer;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OpenWireMessageTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireMessageTest.class);
+
+ protected boolean readOnlyMessage;
+
+ private String jmsMessageID;
+ private String jmsCorrelationID;
+ private OpenWireDestination jmsDestination;
+ private OpenWireDestination jmsReplyTo;
+ private int jmsDeliveryMode;
+ private boolean jmsRedelivered;
+ private String jmsType;
+ private long jmsExpiration;
+ private int jmsPriority;
+ private long jmsTimestamp;
+ private long[] consumerIDs;
+
+ @Before
+ public void setUp() throws Exception {
+ this.jmsMessageID = "ID:TEST-ID:0:0:0:1";
+ this.jmsCorrelationID = "testcorrelationid";
+ this.jmsDestination = new OpenWireTopic("test.topic");
+ this.jmsReplyTo = new OpenWireTempTopic("test.replyto.topic:001");
+ this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
+ this.jmsRedelivered = true;
+ this.jmsType = "test type";
+ this.jmsExpiration = 100000;
+ this.jmsPriority = 5;
+ this.jmsTimestamp = System.currentTimeMillis();
+ this.readOnlyMessage = false;
+ this.consumerIDs = new long[3];
+ for (int i = 0; i < this.consumerIDs.length; i++) {
+ this.consumerIDs[i] = i;
+ }
+ }
+
+ @Test
+ public void testGetDataStructureType() {
+ OpenWireMessage msg = new OpenWireMessage();
+ assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_MESSAGE);
+ }
+
+// @Test
+// public void testHashCode() throws Exception {
+// OpenWireMessage msg = new OpenWireMessage();
+// msg.setMessageId(this.jmsMessageID);
+// assertTrue(msg.getMessageId().hashCode() == jmsMessageID.hashCode());
+// }
+
+ @Test
+ public void testSetToForeignJMSID() throws Exception {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setMessageId("ID:EMS-SERVER.8B443C380083:429");
+ }
+
+ @Test
+ public void testEqualsObject() throws Exception {
+ OpenWireMessage msg1 = new OpenWireMessage();
+ OpenWireMessage msg2 = new OpenWireMessage();
+ msg1.setMessageId(this.jmsMessageID);
+ assertTrue(!msg1.equals(msg2));
+ msg2.setMessageId(this.jmsMessageID);
+ assertTrue(msg1.equals(msg2));
+ }
+
+ @Test
+ public void testShallowCopy() throws Exception {
+ OpenWireMessage msg1 = new OpenWireMessage();
+ msg1.setMessageId(jmsMessageID);
+ OpenWireMessage msg2 = msg1.copy();
+ assertTrue(msg1 != msg2 && msg1.equals(msg2));
+ }
+
+// @Test
+// public void testCopy() throws Exception {
+// this.jmsMessageID = "testid";
+// this.jmsCorrelationID = "testcorrelationid";
+// this.jmsDestination = new OpenWireTopic("test.topic");
+// this.jmsReplyTo = new OpenWireTempTopic("test.replyto.topic:001");
+// this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
+// this.jmsRedelivered = true;
+// this.jmsType = "test type";
+// this.jmsExpiration = 100000;
+// this.jmsPriority = 5;
+// this.jmsTimestamp = System.currentTimeMillis();
+// this.readOnlyMessage = false;
+//
+// OpenWireMessage msg1 = new OpenWireMessage();
+// msg1.setMessageId(this.jmsMessageID);
+// msg1.setCorrelationId(this.jmsCorrelationID);
+// msg1.setDestination(this.jmsDestination);
+// msg1.setReplyTo(this.jmsReplyTo);
+// msg1.setPersistent(this.jmsDeliveryMode == DeliveryMode.PERSISTENT);
+// msg1.setRedelivered(this.jmsRedelivered);
+// msg1.setType(this.jmsType);
+// msg1.setExpiration(this.jmsExpiration);
+// msg1.setPriority((byte) this.jmsPriority);
+// msg1.setTimestamp(this.jmsTimestamp);
+// msg1.setReadOnlyProperties(true);
+// OpenWireMessage msg2 = new OpenWireMessage();
+// msg1.copy(msg2);
+// assertEquals(msg1.getMessageId(), msg2.getMessageId());
+// assertTrue(msg1.getCorrelationId().equals(msg2.getCorrelationId()));
+// assertTrue(msg1.getDestination().equals(msg2.getDestination()));
+// assertTrue(msg1.getReplyTo().equals(msg2.getReplyTo()));
+// assertTrue(msg1.isPersistent() == msg2.isPersistent());
+// assertTrue(msg1.isRedelivered() == msg2.isRedelivered());
+// assertTrue(msg1.getType().equals(msg2.getType()));
+// assertTrue(msg1.getExpiration() == msg2.getExpiration());
+// assertTrue(msg1.getPriority() == msg2.getPriority());
+// assertTrue(msg1.getTimestamp() == msg2.getTimestamp());
+//
+// LOG.info("Message is: " + msg1);
+// }
+
+ @Test
+ public void testGetAndSetMessageId() throws Exception {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setMessageId(this.jmsMessageID);
+ assertEquals(msg.getMessageId().toString(), this.jmsMessageID);
+ }
+
+ @Test
+ public void testGetAndSetTimestamp() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setTimestamp(this.jmsTimestamp);
+ assertTrue(msg.getTimestamp() == this.jmsTimestamp);
+ }
+
+ @Test
+ public void testGetCorrelationIDAsBytes() throws Exception {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setCorrelationId(this.jmsCorrelationID);
+ byte[] testbytes = msg.getCorrelationIdAsBytes();
+ String str2 = new String(testbytes);
+ assertTrue(this.jmsCorrelationID.equals(str2));
+ }
+
+ @Test
+ public void testSetCorrelationIDAsBytes() throws Exception {
+ OpenWireMessage msg = new OpenWireMessage();
+ byte[] testbytes = this.jmsCorrelationID.getBytes();
+ msg.setCorrelationIdAsBytes(testbytes);
+ testbytes = msg.getCorrelationIdAsBytes();
+ String str2 = new String(testbytes);
+ assertTrue(this.jmsCorrelationID.equals(str2));
+ }
+
+ @Test
+ public void testGetAndSetCorrelationID() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setCorrelationId(this.jmsCorrelationID);
+ assertTrue(msg.getCorrelationId().equals(this.jmsCorrelationID));
+ }
+
+ @Test
+ public void testGetAndSetJMSReplyTo() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setReplyTo(this.jmsReplyTo);
+ assertTrue(msg.getReplyTo().equals(this.jmsReplyTo));
+ }
+
+ @Test
+ public void testGetAndSetJMSDestination() throws Exception {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setDestination(this.jmsDestination);
+ assertTrue(msg.getDestination().equals(this.jmsDestination));
+ }
+
+ @Test
+ public void testGetAndSetPersistentFlag() {
+ OpenWireMessage msg = new OpenWireMessage();
+ boolean persistent = this.jmsDeliveryMode == DeliveryMode.PERSISTENT;
+ msg.setPersistent(persistent);
+ assertTrue(msg.isPersistent() == persistent);
+ }
+
+ @Test
+ public void testGetAndSetRedelivered() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setRedelivered(this.jmsRedelivered);
+ assertTrue(msg.isRedelivered() == this.jmsRedelivered);
+ }
+
+ @Test
+ public void testGetAndSetType() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setType(this.jmsType);
+ assertTrue(msg.getType().equals(this.jmsType));
+ }
+
+ @Test
+ public void testGetAndSetExpiration() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setExpiration(this.jmsExpiration);
+ assertTrue(msg.getExpiration() == this.jmsExpiration);
+ }
+
+ @Test
+ public void testGetAndSetPriority() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setPriority((byte) this.jmsPriority);
+ assertTrue(msg.getPriority() == this.jmsPriority);
+
+ msg.setPriority((byte) -90);
+ assertEquals(0, msg.getPriority());
+
+ msg.setPriority((byte) 90);
+ assertEquals(9, msg.getPriority());
+ }
+
+ @Test
+ public void testClearProperties() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setProperty("test", "test");
+ msg.setContent(new Buffer(new byte[1], 0, 0));
+ msg.setMessageId(this.jmsMessageID);
+ msg.clearProperties();
+ assertNull(msg.getProperty("test"));
+ assertNotNull(msg.getMessageId());
+ assertNotNull(msg.getContent());
+ }
+
+ @Test
+ public void testPropertyExists() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setProperty("test", "test");
+ assertTrue(msg.propertyExists("test"));
+
+ msg.setProperty("JMSXDeliveryCount", 1);
+ assertTrue(msg.propertyExists("JMSXDeliveryCount"));
+ }
+
+ @Test
+ public void testGetBooleanProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "booleanProperty";
+ msg.setProperty(name, true);
+ assertTrue((Boolean) msg.getProperty(name));
+ }
+
+ @Test
+ public void testGetByteProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "byteProperty";
+ msg.setProperty(name, (byte) 1);
+ assertTrue((Byte) msg.getProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetShortProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "shortProperty";
+ msg.setProperty(name, (short) 1);
+ assertTrue((Short) msg.getProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetIntProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "intProperty";
+ msg.setProperty(name, 1);
+ assertTrue((Integer) msg.getProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetLongProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "longProperty";
+ msg.setProperty(name, 1L);
+ assertTrue((Long) msg.getProperty(name) == 1L);
+ }
+
+ @Test
+ public void testGetFloatProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "floatProperty";
+ msg.setProperty(name, 1.3f);
+ assertTrue((Float) msg.getProperty(name) == 1.3f);
+ }
+
+ @Test
+ public void testGetDoubleProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "doubleProperty";
+ msg.setProperty(name, 1.3d);
+ assertTrue((Double) msg.getProperty(name) == 1.3);
+ }
+
+ @Test
+ public void testGetStringProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "stringProperty";
+ msg.setProperty(name, name);
+ assertTrue(msg.getProperty(name).equals(name));
+ }
+
+ @Test
+ public void testgetProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "floatProperty";
+ msg.setProperty(name, 1.3f);
+ assertTrue(msg.getProperty(name) instanceof Float);
+ assertTrue(((Float) msg.getProperty(name)).floatValue() == 1.3f);
+ }
+
+ @Test
+ public void testPropertiesInt() throws Exception {
+ OpenWireObjectMessage message = new OpenWireObjectMessage();
+ message.setProperty("TestProp", 333);
+ fakeUnmarshal(message);
+ roundTripProperties(message);
+ }
+
+ @Test
+ public void testPropertiesString() throws Exception {
+ OpenWireObjectMessage message = new OpenWireObjectMessage();
+ message.setProperty("TestProp", "Value");
+ fakeUnmarshal(message);
+ roundTripProperties(message);
+ }
+
+ @Test
+ public void testPropertiesObject() throws Exception {
+ OpenWireObjectMessage message = new OpenWireObjectMessage();
+ message.setProperty("TestProp", "Value");
+ fakeUnmarshal(message);
+ roundTripProperties(message);
+ }
+
+ @Test
+ public void testPropertiesObjectNoMarshalling() throws Exception {
+ OpenWireObjectMessage message = new OpenWireObjectMessage();
+ message.setProperty("TestProp", "Value");
+ roundTripProperties(message);
+ }
+
+ private void roundTripProperties(OpenWireObjectMessage message) throws IOException, JMSException {
+ OpenWireObjectMessage copy = new OpenWireObjectMessage();
+ for (Map.Entry<String, Object> prop : message.getProperties().entrySet()) {
+ LOG.debug("{} -> {}", prop.getKey(), prop.getValue().getClass());
+ copy.setProperty(prop.getKey(), prop.getValue());
+ }
+ }
+
+ private void fakeUnmarshal(OpenWireObjectMessage message) throws Exception {
+ OpenWireFormat format = new OpenWireFormat(OpenWireFormat.DEFAULT_WIRE_VERSION);
+ message.beforeMarshall(format);
+ message.afterMarshall(format);
+
+ Buffer seq = message.getMarshalledProperties();
+ message.clearProperties();
+ message.setMarshalledProperties(seq);
+ }
+
+ @Test
+ public void testSetNullProperty() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ String name = "cheese";
+ msg.setProperty(name, "Cheddar");
+ assertEquals("Cheddar", msg.getProperty(name));
+
+ msg.setProperty(name, null);
+ assertEquals(null, msg.getProperty(name));
+ }
+
+ @Test
+ public void testSetNullPropertyName() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+
+ try {
+ msg.setProperty(null, "Cheese");
+ fail("Should have thrown exception");
+ } catch (IllegalArgumentException e) {
+ LOG.info("Worked, caught: " + e);
+ }
+ }
+
+ @Test
+ public void testSetEmptyPropertyName() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+
+ try {
+ msg.setProperty("", "Cheese");
+ fail("Should have thrown exception");
+ } catch (IllegalArgumentException e) {
+ LOG.info("Worked, caught: " + e);
+ }
+ }
+
+ @Test
+ public void testGetAndSetDeliveryCount() throws JMSException {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setRedeliveryCounter(1);
+ int count = msg.getRedeliveryCounter();
+ assertTrue("expected delivery count = 1 - got: " + count, count == 1);
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireBytesMessage message = new OpenWireBytesMessage();
+ message.clearBody();
+ assertNull(message.getContent());
+ }
+
+ @Test
+ public void testIsExpired() {
+ OpenWireMessage msg = new OpenWireMessage();
+ msg.setExpiration(System.currentTimeMillis() - 1);
+ assertTrue(msg.isExpired());
+ msg.setExpiration(System.currentTimeMillis() + 10000);
+ assertFalse(msg.isExpired());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireObjectMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireObjectMessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireObjectMessageTest.java
new file mode 100644
index 0000000..5363df8
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireObjectMessageTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class OpenWireObjectMessageTest {
+
+ @Test
+ public void testBytes() throws JMSException, IOException {
+ OpenWireObjectMessage msg = new OpenWireObjectMessage();
+ String str = "testText";
+ msg.setObject(str);
+
+ msg = (OpenWireObjectMessage) msg.copy();
+ assertEquals(msg.getObject(), str);
+ }
+
+ @Test
+ public void testSetObject() throws JMSException {
+ OpenWireObjectMessage msg = new OpenWireObjectMessage();
+ String str = "testText";
+ msg.setObject(str);
+ assertTrue(msg.getObject() == str);
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireObjectMessage objectMessage = new OpenWireObjectMessage();
+ try {
+ objectMessage.setObject("String");
+ objectMessage.clearBody();
+ assertNull(objectMessage.getObject());
+ objectMessage.setObject("String");
+ objectMessage.getObject();
+ } catch (MessageNotWriteableException mnwe) {
+ fail("should be writeable");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireStreamMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireStreamMessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireStreamMessageTest.java
new file mode 100644
index 0000000..cd3c299
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireStreamMessageTest.java
@@ -0,0 +1,116 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+import org.fusesource.hawtbuf.Buffer;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class OpenWireStreamMessageTest {
+
+ private final List<Object> elements = new ArrayList<Object>();
+
+ @Before
+ public void setUp() throws Exception {
+
+ elements.add(Boolean.TRUE);
+ elements.add(Byte.valueOf(Byte.MAX_VALUE));
+ elements.add(Character.valueOf('a'));
+ elements.add(Short.valueOf(Short.MAX_VALUE));
+ elements.add(Integer.valueOf(Integer.MAX_VALUE));
+ elements.add(Long.valueOf(Long.MAX_VALUE));
+ elements.add(Float.valueOf(Float.MAX_VALUE));
+ elements.add(Double.valueOf(Double.MAX_VALUE));
+ elements.add("Test-String");
+ elements.add(new byte[] { 1, 2, 3, 4, 5, 6 });
+ }
+
+ @Test
+ public void testGetDataStructureType() {
+ OpenWireStreamMessage msg = new OpenWireStreamMessage();
+ assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_STREAM_MESSAGE);
+ }
+
+ @Test
+ public void testWriteListToStream() throws Exception {
+ OpenWireStreamMessage message = new OpenWireStreamMessage();
+
+ message.writeListToStream(Collections.emptyList());
+ assertNull(message.getContent());
+ message.writeListToStream(elements);
+ assertNotNull(message.getContent());
+ }
+
+ @Test
+ public void testWriteListToStreamCompressed() throws Exception {
+ OpenWireStreamMessage message = new OpenWireStreamMessage();
+ message.setUseCompression(true);
+
+ // Add something that should compress well.
+ elements.add("Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" +
+ "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" +
+ "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String");
+
+ message.writeListToStream(Collections.emptyList());
+ assertNull(message.getContent());
+ message.writeListToStream(elements);
+ assertNotNull(message.getContent());
+
+ Buffer rawContent = message.getContent();
+ Buffer processedContent = message.getPayload();
+
+ assertTrue(rawContent.length() < processedContent.length());
+ }
+
+ @Test
+ public void testReadStreamToList() throws Exception {
+ OpenWireStreamMessage message = new OpenWireStreamMessage();
+
+ message.writeListToStream(elements);
+ assertNotNull(message.getContent());
+
+ List<Object> results = message.readStreamToList();
+ assertEquals(elements.size(), results.size());
+
+ for (int i = 0; i < results.size(); ++i) {
+
+ Object element = elements.get(i);
+ Object result = results.get(i);
+
+ if (result instanceof byte[]) {
+ assertTrue(Arrays.equals((byte[]) result, (byte[]) element));
+ } else {
+ assertEquals(element, result);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireTextMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireTextMessageTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireTextMessageTest.java
new file mode 100644
index 0000000..c92f92c
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireTextMessageTest.java
@@ -0,0 +1,131 @@
+/**
+ * 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.commands;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+import org.apache.activemq.util.MarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class OpenWireTextMessageTest {
+
+ @Test
+ public void testGetDataStructureType() {
+ OpenWireTextMessage msg = new OpenWireTextMessage();
+ assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_TEXT_MESSAGE);
+ }
+
+ @Test
+ public void testShallowCopy() throws JMSException {
+ OpenWireTextMessage msg = new OpenWireTextMessage();
+ String string = "str";
+ msg.setText(string);
+ Message copy = msg.copy();
+ assertTrue(msg.getText() == ((OpenWireTextMessage) copy).getText());
+ }
+
+ @Test
+ public void testSetText() {
+ OpenWireTextMessage msg = new OpenWireTextMessage();
+ String str = "testText";
+ try {
+ msg.setText(str);
+ assertEquals(msg.getText(), str);
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testGetBytes() throws JMSException, IOException {
+ OpenWireTextMessage msg = new OpenWireTextMessage();
+ String str = "testText";
+ msg.setText(str);
+ msg.beforeMarshall(null);
+
+ Buffer bytes = msg.getContent();
+ msg = new OpenWireTextMessage();
+ msg.setContent(bytes);
+
+ assertEquals(msg.getText(), str);
+ }
+
+ @Test
+ public void testClearBody() throws JMSException, IOException {
+ OpenWireTextMessage textMessage = new OpenWireTextMessage();
+ textMessage.setText("string");
+ textMessage.clearBody();
+ assertNull(textMessage.getText());
+ try {
+ textMessage.setText("String");
+ textMessage.getText();
+ } catch (MessageNotWriteableException mnwe) {
+ fail("should be writeable");
+ } catch (MessageNotReadableException mnre) {
+ fail("should be readable");
+ }
+ }
+
+ @Test
+ public void testShortText() throws Exception {
+ String shortText = "Content";
+ OpenWireTextMessage shortMessage = new OpenWireTextMessage();
+ setContent(shortMessage, shortText);
+ assertTrue(shortMessage.toString().contains("text = " + shortText));
+ assertTrue(shortMessage.getText().equals(shortText));
+
+ String longText = "Very very very very veeeeeeery loooooooooooooooooooooooooooooooooong text";
+ String longExpectedText = "Very very very very veeeeeeery looooooooooooo...ooooong text";
+ OpenWireTextMessage longMessage = new OpenWireTextMessage();
+ setContent(longMessage, longText);
+ assertTrue(longMessage.toString().contains("text = " + longExpectedText));
+ assertTrue(longMessage.getText().equals(longText));
+ }
+
+ @Test
+ public void testNullText() throws Exception {
+ OpenWireTextMessage nullMessage = new OpenWireTextMessage();
+ setContent(nullMessage, null);
+ assertTrue(nullMessage.toString().contains("text = null"));
+ }
+
+ void setContent(Message message, String text) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(baos);
+ MarshallingSupport.writeUTF8(dataOut, text);
+ dataOut.close();
+ message.setContent(baos.toBuffer());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/ide/OpenWireCodecGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/ide/OpenWireCodecGenerator.java b/openwire-core/src/test/java/org/apache/activemq/openwire/ide/OpenWireCodecGenerator.java
new file mode 100644
index 0000000..e066fe7
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/ide/OpenWireCodecGenerator.java
@@ -0,0 +1,121 @@
+/**
+ * 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.ide;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.generator.GeneratorTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Utility class for running the OpenWire source generator from within an
+ * IDE or as part of a test.
+ */
+public class OpenWireCodecGenerator {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireCodecGenerator.class);
+
+ private final GeneratorTask generator = new GeneratorTask();
+
+ private int baseVersion = 10;
+ private int maxVersion = 10;
+
+ private File sourceDir;
+ private File targetDir;
+
+ /**
+ * @param args
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException {
+
+ OpenWireCodecGenerator runner = new OpenWireCodecGenerator();
+
+ runner.setBaseVersion(10);
+ runner.setMaxVersion(10);
+
+ File sourceDir = new File("./src/main/java/io/neutronjms/openwire/commands").getCanonicalFile();
+ File targetDir = new File("./target/generated-sources/openwire").getCanonicalFile();
+
+ if (!sourceDir.exists()) {
+ throw new IOException("Source dir does not exist. " + sourceDir);
+ }
+
+ if (!targetDir.exists()) {
+ targetDir.createNewFile();
+ if (!targetDir.exists()) {
+ throw new IOException("Source dir does not exist. " + targetDir);
+ }
+ }
+
+ runner.setSourceDir(sourceDir);
+ runner.setTargetDir(targetDir);
+
+ runner.generate();
+ }
+
+ /**
+ * Runs the OpenWire generator using the configured generation values.
+ */
+ public void generate() {
+ generator.setFromVersion(getBaseVersion());
+ generator.setToVersion(getMaxVersion());
+ generator.setSourceDir(getSourceDir());
+ generator.setTargetDir(getTargetDir());
+
+ try {
+ generator.execute();
+ } catch (RuntimeException e) {
+ LOG.warn("Caught exception while executing generator: ", e);
+ throw e;
+ }
+ }
+
+ public int getBaseVersion() {
+ return baseVersion;
+ }
+
+ public void setBaseVersion(int version) {
+ this.baseVersion = version;
+ }
+
+ public int getMaxVersion() {
+ return maxVersion;
+ }
+
+ public void setMaxVersion(int version) {
+ this.maxVersion = version;
+ }
+
+ public File getSourceDir() {
+ return sourceDir;
+ }
+
+ public void setSourceDir(File sourceDir) {
+ this.sourceDir = sourceDir;
+ }
+
+ public File getTargetDir() {
+ return targetDir;
+ }
+
+ public void setTargetDir(File targetDir) {
+ this.targetDir = targetDir;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/utils/CronParserTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/utils/CronParserTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/utils/CronParserTest.java
new file mode 100644
index 0000000..907b524
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/utils/CronParserTest.java
@@ -0,0 +1,363 @@
+/**
+ * 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.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Calendar;
+import java.util.List;
+
+import javax.jms.MessageFormatException;
+
+import org.apache.activemq.openwire.utils.CronParser;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CronParserTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CronParserTest.class);
+
+ @Test
+ public void testgetNextTimeDayOfWeek() throws MessageFormatException {
+
+ // using an absolute date so that result will be absolute - Monday 15 Nov 2010
+ Calendar current = Calendar.getInstance();
+ current.set(2010, Calendar.NOVEMBER, 15, 9, 15, 30);
+ LOG.debug("start:" + current.getTime());
+
+ String test = "* * * * 5";
+ long next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ Calendar result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(0,result.get(Calendar.MINUTE));
+ assertEquals(0,result.get(Calendar.HOUR));
+ // expecting Friday 19th
+ assertEquals(19,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.NOVEMBER,result.get(Calendar.MONTH));
+ assertEquals(2010,result.get(Calendar.YEAR));
+ }
+
+ @Test
+ public void testgetNextTimeDayOfWeekVariant() throws MessageFormatException {
+
+ // using an absolute date so that result will be absolute - Monday 7 March 2011
+ Calendar current = Calendar.getInstance();
+ current.set(2011, Calendar.MARCH, 7, 9, 15, 30);
+ LOG.debug("start:" + current.getTime());
+
+ String test = "50 20 * * 5";
+ long next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ Calendar result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(50,result.get(Calendar.MINUTE));
+ assertEquals(20,result.get(Calendar.HOUR_OF_DAY));
+ // expecting Friday 11th
+ assertEquals(11,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.FRIDAY,result.get(Calendar.DAY_OF_WEEK));
+ assertEquals(Calendar.MARCH,result.get(Calendar.MONTH));
+ assertEquals(2011,result.get(Calendar.YEAR));
+
+ // Match to the day of week, but to late to run, should just a week forward.
+ current = Calendar.getInstance();
+ current.set(2011, Calendar.MARCH, 11, 22, 0, 30);
+ LOG.debug("update:" + current.getTime());
+
+ next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ //assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(50,result.get(Calendar.MINUTE));
+ assertEquals(20,result.get(Calendar.HOUR_OF_DAY));
+ // expecting Friday 18th
+ assertEquals(18,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.FRIDAY,result.get(Calendar.DAY_OF_WEEK));
+ assertEquals(Calendar.MARCH,result.get(Calendar.MONTH));
+ assertEquals(2011,result.get(Calendar.YEAR));
+ }
+
+ @Test
+ public void testgetNextTimeMonthVariant() throws MessageFormatException {
+
+ // using an absolute date so that result will be absolute - Monday 7 March 2011
+ Calendar current = Calendar.getInstance();
+ current.set(2011, Calendar.MARCH, 7, 9, 15, 30);
+ LOG.debug("start:" + current.getTime());
+
+ String test = "0 20 * 4,5 0";
+ long next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ Calendar result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(0,result.get(Calendar.MINUTE));
+ assertEquals(20,result.get(Calendar.HOUR_OF_DAY));
+ // expecting Sunday 3rd of April
+ assertEquals(Calendar.APRIL,result.get(Calendar.MONTH));
+ assertEquals(3,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.SUNDAY,result.get(Calendar.DAY_OF_WEEK));
+ assertEquals(2011,result.get(Calendar.YEAR));
+
+ current = Calendar.getInstance();
+ current.set(2011, Calendar.APRIL, 30, 22, 0, 30);
+ LOG.debug("update:" + current.getTime());
+
+ next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(0,result.get(Calendar.MINUTE));
+ assertEquals(20,result.get(Calendar.HOUR_OF_DAY));
+ // expecting Sunday 1st of May
+ assertEquals(1,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.SUNDAY,result.get(Calendar.DAY_OF_WEEK));
+ assertEquals(Calendar.MAY,result.get(Calendar.MONTH));
+ assertEquals(2011,result.get(Calendar.YEAR));
+
+ // Move past last time and see if reschedule to next year works.
+ current = Calendar.getInstance();
+ current.set(2011, Calendar.MAY, 30, 22, 0, 30);
+ LOG.debug("update:" + current.getTime());
+
+ next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(0,result.get(Calendar.MINUTE));
+ assertEquals(20,result.get(Calendar.HOUR_OF_DAY));
+ // expecting Sunday 1st of April - 2012
+ assertEquals(1,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.SUNDAY,result.get(Calendar.DAY_OF_WEEK));
+ assertEquals(Calendar.APRIL,result.get(Calendar.MONTH));
+ assertEquals(2012,result.get(Calendar.YEAR));
+ }
+
+ @Test
+ public void testgetNextTimeMonth() throws MessageFormatException {
+
+ // using an absolute date so that result will be absolute - Monday 15 Nov 2010
+ Calendar current = Calendar.getInstance();
+ current.set(2010, Calendar.NOVEMBER, 15, 9, 15, 30);
+ LOG.debug("start:" + current.getTime());
+
+ String test = "* * * 12 *";
+ long next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ Calendar result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(0,result.get(Calendar.MINUTE));
+ assertEquals(0,result.get(Calendar.HOUR_OF_DAY));
+ assertEquals(1,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.DECEMBER,result.get(Calendar.MONTH));
+ assertEquals(2010,result.get(Calendar.YEAR));
+ }
+
+ @Test
+ public void testgetNextTimeDays() throws MessageFormatException {
+
+ // using an absolute date so that result will be absolute - Monday 15 Nov 2010
+ Calendar current = Calendar.getInstance();
+ current.set(2010, Calendar.NOVEMBER, 15, 9, 15, 30);
+ LOG.debug("start:" + current.getTime());
+
+ String test = "* * 16 * *";
+ long next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
+
+ Calendar result = Calendar.getInstance();
+ result.setTimeInMillis(next);
+ LOG.debug("next:" + result.getTime());
+
+ assertEquals(0,result.get(Calendar.SECOND));
+ assertEquals(0,result.get(Calendar.MINUTE));
+ assertEquals(0,result.get(Calendar.HOUR));
+ assertEquals(16,result.get(Calendar.DAY_OF_MONTH));
+ assertEquals(Calendar.NOVEMBER,result.get(Calendar.MONTH));
+ assertEquals(2010,result.get(Calendar.YEAR));
+ }
+
+ @Test
+ public void testgetNextTimeMinutes() throws MessageFormatException {
+ String test = "30 * * * *";
+ long current = 20*60*1000;
+ Calendar calender = Calendar.getInstance();
+ calender.setTimeInMillis(current);
+ LOG.debug("start:" + calender.getTime());
+ long next = CronParser.getNextScheduledTime(test, current);
+
+ calender.setTimeInMillis(next);
+ LOG.debug("next:" + calender.getTime());
+ long result = next - current;
+ assertEquals(60*10*1000,result);
+ }
+
+ @Test
+ public void testgetNextTimeHours() throws MessageFormatException {
+ String test = "* 1 * * *";
+
+ Calendar calender = Calendar.getInstance();
+ calender.set(1972, 2, 2, 17, 10, 0);
+ long current = calender.getTimeInMillis();
+ long next = CronParser.getNextScheduledTime(test, current);
+
+ calender.setTimeInMillis(next);
+ long result = next - current;
+ long expected = 60*1000*60*8 + 60 * 1000;
+ assertEquals(expected,result);
+ }
+
+ @Test
+ public void testgetNextTimeHoursZeroMin() throws MessageFormatException {
+ String test = "0 1 * * *";
+
+ Calendar calender = Calendar.getInstance();
+ calender.set(1972, 2, 2, 17, 10, 0);
+ long current = calender.getTimeInMillis();
+ long next = CronParser.getNextScheduledTime(test, current);
+
+ calender.setTimeInMillis(next);
+ long result = next - current;
+ long expected = 60*1000*60*7 + 60*1000*50;
+ assertEquals(expected,result);
+ }
+
+ @Test
+ public void testValidate() {
+ try {
+ CronParser.validate("30 08 10 06 ? ");
+ CronParser.validate("30 08 ? 06 5 ");
+ CronParser.validate("30 08 ? 06 * ");
+ CronParser.validate("* * * * * ");
+ CronParser.validate("* * * * 1-6 ");
+ CronParser.validate("* * * * 1,2,5 ");
+ CronParser.validate("*/10 0-4,8-12 * * 1-2,3-6/2 ");
+
+ } catch (Exception e) {
+ fail("Should be valid ");
+ }
+
+ try {
+ CronParser.validate("61 08 10 06 * ");
+ fail("Should not be valid ");
+ } catch (Exception e) {
+ }
+ try {
+ CronParser.validate("61 08 06 * ");
+ fail("Should not be valid ");
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testGetNextCommaSeparated() throws MessageFormatException {
+ String token = "3,5,7";
+ // test minimum values
+ int next = CronParser.getNext(createEntry(token, 1, 10), 3);
+ assertEquals(2, next);
+ next = CronParser.getNext(createEntry(token, 1, 10), 8);
+ assertEquals(4, next);
+ next = CronParser.getNext(createEntry(token, 1, 10), 1);
+ assertEquals(2, next);
+ }
+
+ @Test
+ public void testGetNextRange() throws MessageFormatException {
+ String token = "3-5";
+ // test minimum values
+ int next = CronParser.getNext(createEntry(token, 1, 10), 3);
+ assertEquals(1, next);
+ next = CronParser.getNext(createEntry(token, 1, 10), 5);
+ assertEquals(7, next);
+ next = CronParser.getNext(createEntry(token, 1, 10), 6);
+ assertEquals(6, next);
+ next = CronParser.getNext(createEntry(token, 1, 10), 1);
+ assertEquals(2, next);
+ }
+
+ @Test
+ public void testGetNextExact() throws MessageFormatException {
+ String token = "3";
+ int next = CronParser.getNext(createEntry(token, 0, 10), 2);
+ assertEquals(1, next);
+ next = CronParser.getNext(createEntry(token, 0, 10), 3);
+ assertEquals(10, next);
+ next = CronParser.getNext(createEntry(token, 0, 10), 1);
+ assertEquals(2, next);
+ }
+
+ @Test
+ public void testTokenize() {
+ String test = "*/5 * * * *";
+ List<String> list = CronParser.tokenize(test);
+ assertEquals(list.size(), 5);
+
+ test = "*/5 * * * * *";
+ try {
+ list = CronParser.tokenize(test);
+ fail("Should have throw an exception");
+ } catch (Throwable e) {
+ }
+
+ test = "*/5 * * * *";
+ try {
+ list = CronParser.tokenize(test);
+ fail("Should have throw an exception");
+ } catch (Throwable e) {
+ }
+
+ test = "0 1 2 3 4";
+ list = CronParser.tokenize(test);
+ assertEquals(list.size(), 5);
+
+ assertEquals(list.get(0), "0");
+ assertEquals(list.get(1), "1");
+ assertEquals(list.get(2), "2");
+ assertEquals(list.get(3), "3");
+ assertEquals(list.get(4), "4");
+ }
+
+ public void testGetNextScheduledTime() {
+ fail("Not yet implemented");
+ }
+
+ CronParser.CronEntry createEntry(String str, int start, int end) {
+ return new CronParser.CronEntry("test", str, start, end);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupportTest.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupportTest.java b/openwire-core/src/test/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupportTest.java
new file mode 100644
index 0000000..f40a31a
--- /dev/null
+++ b/openwire-core/src/test/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupportTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.utils;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.DataInputStream;
+
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+import org.junit.Test;
+
+public class OpenWireMarshallingSupportTest {
+
+ @Test
+ public void testMarshalBoolean() throws Exception {
+ DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream();
+ OpenWireMarshallingSupport.marshalBoolean(dataOut, false);
+ OpenWireMarshallingSupport.marshalBoolean(dataOut, true);
+ DataByteArrayInputStream input = new DataByteArrayInputStream(dataOut.toBuffer());
+ DataInputStream dataIn = new DataInputStream(input);
+ Boolean result = (Boolean) OpenWireMarshallingSupport.unmarshalPrimitive(dataIn);
+ assertFalse(result);
+ result = (Boolean) OpenWireMarshallingSupport.unmarshalPrimitive(dataIn);
+ assertTrue(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/openwire-core/src/test/resources/log4j.properties b/openwire-core/src/test/resources/log4j.properties
new file mode 100644
index 0000000..0588275
--- /dev/null
+++ b/openwire-core/src/test/resources/log4j.properties
@@ -0,0 +1,41 @@
+## ---------------------------------------------------------------------------
+## 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
+
+# Tune the ActiveMQ and it's OpenWire transport as needed for debugging.
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.broker=DEBUG
+log4j.logger.org.apache.activemq.transport.openwire=TRACE
+log4j.logger.org.apache.activemq.transport.openwire.FRAMES=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/7ae454fa/openwire-generator/.gitignore
----------------------------------------------------------------------
diff --git a/openwire-generator/.gitignore b/openwire-generator/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/openwire-generator/.gitignore
@@ -0,0 +1 @@
+/target
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-generator/pom.xml b/openwire-generator/pom.xml
new file mode 100644
index 0000000..1cde472
--- /dev/null
+++ b/openwire-generator/pom.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-protocol</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openwire-generator</artifactId>
+ <name>openwire-generator</name>
+ <description>An OpenWire marshaller generator for the OpenWire Protocol library</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <!-- =================================== -->
+ <!-- Required Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>gram</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0-jsr-04</version>
+ </dependency>
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default-tools.jar</id>
+ <activation>
+ <property>
+ <name>java.vendor</name>
+ <value>Sun Microsystems Inc.</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.6.0</version>
+ <scope>system</scope>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/GeneratorTask.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/GeneratorTask.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/GeneratorTask.java
new file mode 100644
index 0000000..24573d1
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/GeneratorTask.java
@@ -0,0 +1,206 @@
+/**
+ * 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;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.codehaus.jam.JamService;
+import org.codehaus.jam.JamServiceFactory;
+import org.codehaus.jam.JamServiceParams;
+
+/**
+ * The main task that controls the OpenWire code generation routines.
+ */
+public class GeneratorTask extends Task {
+
+ protected int fromVersion = 1;
+ protected int toVersion = 1;
+ protected boolean rangedGenerate = true;
+ protected File sourceDir = new File("./src/main/java");
+ protected File targetDir = new File("./src/main/java");
+ protected boolean generateMarshalers = true;
+ protected boolean generateTests = false;
+ protected String commandsPackage;
+ protected String codecPackageRoot;
+
+ public static void main(String[] args) {
+
+ Project project = new Project();
+ project.init();
+ GeneratorTask generator = new GeneratorTask();
+ generator.setProject(project);
+
+ if (args.length > 0) {
+ generator.fromVersion = Integer.parseInt(args[0]);
+ }
+
+ if (args.length > 0) {
+ generator.toVersion = Integer.parseInt(args[0]);
+ }
+
+ if (args.length > 1) {
+ generator.sourceDir = new File(args[1]);
+ }
+
+ if (args.length > 2) {
+ generator.targetDir = new File(args[1]);
+ }
+
+ if (args.length > 3) {
+ generator.commandsPackage = args[2];
+ }
+
+ if (args.length > 4) {
+ generator.codecPackageRoot = args[3];
+ }
+
+ generator.execute();
+ }
+
+ @Override
+ public void execute() throws BuildException {
+ try {
+ System.out.println("======================================================");
+ System.out.println("OpenWire Generator: Command source files in: ");
+ System.out.println("" + sourceDir);
+ System.out.println("======================================================");
+
+ JamServiceFactory jamServiceFactory = JamServiceFactory.getInstance();
+ JamServiceParams params = jamServiceFactory.createServiceParams();
+ File[] dirs = new File[] { sourceDir };
+ params.includeSourcePattern(dirs, "**/*.java");
+ JamService jam = jamServiceFactory.createService(params);
+
+ if (generateMarshalers) {
+ if (!isRangedGenerate()) {
+ runMarshalerGenerateScript(jam, fromVersion);
+ if (toVersion != fromVersion) {
+ runMarshalerGenerateScript(jam, toVersion);
+ }
+ } else {
+ for (int i = fromVersion; i <= toVersion; ++i) {
+ runMarshalerGenerateScript(jam, i);
+ }
+ }
+ }
+
+ if (generateTests) {
+ if (!isRangedGenerate()) {
+ runTestGenerateScript(jam, fromVersion);
+ if (toVersion != fromVersion) {
+ runTestGenerateScript(jam, toVersion);
+ }
+ } else {
+ for (int i = fromVersion; i <= toVersion; ++i) {
+ runTestGenerateScript(jam, i);
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ throw new BuildException(e);
+ }
+ }
+
+ protected void runMarshalerGenerateScript(JamService jam, int version) throws Exception {
+ System.out.println("======================================================");
+ System.out.println(" Generating Marshallers for OpenWire version: " + version);
+ System.out.println("======================================================");
+ MarshallingGenerator script = new MarshallingGenerator();
+ runScript(script, jam, version);
+ }
+
+ protected void runTestGenerateScript(JamService jam, int version) throws Exception {
+ System.out.println("======================================================");
+ System.out.println(" Generating Test Cases for OpenWire version: " + version);
+ System.out.println("======================================================");
+ TestsGenerator script = new TestsGenerator();
+ runScript(script, jam, version);
+ }
+
+ protected void runScript(MultiSourceGenerator script, JamService jam, int version) throws Exception {
+ script.setJam(jam);
+ script.setTargetDir(targetDir.getCanonicalPath());
+ script.setOpenwireVersion(version);
+ if (commandsPackage != null) {
+ script.setCommandsPackage(commandsPackage);
+ }
+ if (codecPackageRoot != null) {
+ script.setCodecPackageRoot(codecPackageRoot);
+ }
+ script.run();
+ }
+
+ public int getFromVersion() {
+ return fromVersion;
+ }
+
+ public void setFromVersion(int version) {
+ this.fromVersion = version;
+ }
+
+ public int getToVersion() {
+ return toVersion;
+ }
+
+ public void setToVersion(int version) {
+ this.toVersion = version;
+ }
+
+ public File getSourceDir() {
+ return sourceDir;
+ }
+
+ public void setSourceDir(File sourceDir) {
+ this.sourceDir = sourceDir;
+ }
+
+ public File getTargetDir() {
+ return targetDir;
+ }
+
+ public void setTargetDir(File targetDir) {
+ this.targetDir = targetDir;
+ }
+
+ public boolean isGenerateMarshalers() {
+ return generateMarshalers;
+ }
+
+ public void setGenerateMarshalers(boolean generateMarshalers) {
+ this.generateMarshalers = generateMarshalers;
+ }
+
+ public boolean isGenerateTests() {
+ return generateTests;
+ }
+
+ public void setGenerateTests(boolean generateTests) {
+ this.generateTests = generateTests;
+ }
+
+ public boolean isRangedGenerate() {
+ return this.rangedGenerate;
+ }
+
+ public void setRangedGenerate(boolean rangedGenerate) {
+ this.rangedGenerate = rangedGenerate;
+ }
+}
[24/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireStreamMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..00e40de
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..0d7958d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v2;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..fa34ea0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..f135d87
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTextMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..2ac45ab
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..bb237ea
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/PartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/PartialCommandMarshaller.java
new file mode 100644
index 0000000..dbd4998
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerIdMarshaller.java
new file mode 100644
index 0000000..0481137
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerIdMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..6cb3381
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerInfoMarshaller.java
@@ -0,0 +1,161 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..a2e95f8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveInfoMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveSubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..4913957
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v2;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ReplayCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..8a8ada5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ResponseMarshaller.java
new file mode 100644
index 0000000..fb6fcb4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ResponseMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionIdMarshaller.java
new file mode 100644
index 0000000..86c9f54
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionIdMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionInfoMarshaller.java
new file mode 100644
index 0000000..19ab797
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SessionInfoMarshaller.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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ShutdownInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..56a8490
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..1f3a688
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/SubscriptionInfoMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionIdMarshaller.java
new file mode 100644
index 0000000..4b06fc1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v2;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[25/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..973fe5e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/LocalTransactionIdMarshaller.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.v2;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MarshallerFactory.java
new file mode 100644
index 0000000..cd1e12f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MarshallerFactory.java
@@ -0,0 +1,93 @@
+/**
+ * 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.v2;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageAckMarshaller.java
new file mode 100644
index 0000000..ae917a1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageAckMarshaller.java
@@ -0,0 +1,155 @@
+/**
+ * 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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..679253e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..0524d5b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageIdMarshaller.java
new file mode 100644
index 0000000..66a046c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageMarshaller.java
new file mode 100644
index 0000000..58e28c1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessageMarshaller.java
@@ -0,0 +1,269 @@
+/**
+ * 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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessagePullMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessagePullMarshaller.java
new file mode 100644
index 0000000..c6452c1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/MessagePullMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v2;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..33c1aee
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v2;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..f9da67b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..6d38eed
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireDestinationMarshaller.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.v2;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..bf38446
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..5f3638a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..5cb5bb8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..3abf22e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[19/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..8bc0559
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/TransactionInfoMarshaller.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.v3;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..009cf33
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..c7fbb44
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v3;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BaseCommandMarshaller.java
new file mode 100644
index 0000000..1a628d2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/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.v4;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerIdMarshaller.java
new file mode 100644
index 0000000..c0c4a6b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerIdMarshaller.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.v4;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..2fa4b97
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v4;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..da5c928
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionControlMarshaller.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.v4;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..22dff2b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/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.v4;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..fc4a5b5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/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.v4;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..4ea2b3e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConnectionInfoMarshaller.java
@@ -0,0 +1,174 @@
+/**
+ * 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.v4;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(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());
+ bs.writeBoolean(info.isClientMaster());
+
+ 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();
+ 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((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(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());
+ dataOut.writeBoolean(info.isClientMaster());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..534092d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..0fd3d63
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/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.v4;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..2a968c2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ConsumerInfoMarshaller.java
@@ -0,0 +1,248 @@
+/**
+ * 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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ControlCommandMarshaller.java
new file mode 100644
index 0000000..4760aa3
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v4;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
[04/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..0574b7e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..073ac2d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTextMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..8e708b0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTopicMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..a019bd7
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/PartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/PartialCommandMarshaller.java
new file mode 100644
index 0000000..9d9b34f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerAckMarshaller.java
new file mode 100644
index 0000000..c4ae1ff
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerIdMarshaller.java
new file mode 100644
index 0000000..35cd367
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerIdMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..3f32834
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..2a5e692
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveInfoMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ looseMarshalLong(wireFormat, info.getLastDeliveredSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveSubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..bfe6a55
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v7;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ReplayCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..a7ecc55
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ResponseMarshaller.java
new file mode 100644
index 0000000..a780edf
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ResponseMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionIdMarshaller.java
new file mode 100644
index 0000000..7bb4e1c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionIdMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionInfoMarshaller.java
new file mode 100644
index 0000000..0ff78b5
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SessionInfoMarshaller.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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ShutdownInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..9a0e2be
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SubscriptionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..37dae72
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionIdMarshaller.java
new file mode 100644
index 0000000..d18d470
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v7;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[44/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchNotificationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..41bd4d2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageIdMarshaller.java
new file mode 100644
index 0000000..69d787d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageIdMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setTextView(tightUnmarshalString(dataIn, bs));
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getTextView(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalString2(info.getTextView(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setTextView(looseUnmarshalString(dataIn));
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getTextView(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageMarshaller.java
new file mode 100644
index 0000000..c6c64c7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessageMarshaller.java
@@ -0,0 +1,309 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setJMSXGroupFirstForConsumer(bs.readBoolean());
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+ bs.writeBoolean(info.isJMSXGroupFirstForConsumer());
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+ bs.readBoolean();
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setJMSXGroupFirstForConsumer(dataIn.readBoolean());
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ dataOut.writeBoolean(info.isJMSXGroupFirstForConsumer());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessagePullMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessagePullMarshaller.java
new file mode 100644
index 0000000..a7161d5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v10;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/NetworkBridgeFilterMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..f1ca70b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v10;
+
+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;
+import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
+
+public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new NetworkBridgeFilter();
+ }
+
+ /**
+ * 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);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+ info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageTTL(dataIn.readInt());
+ info.setConsumerTTL(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
+
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+ tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageTTL());
+ dataOut.writeInt(info.getConsumerTTL());
+ }
+
+ /**
+ * 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);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+ info.setNetworkBrokerId((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageTTL(dataIn.readInt());
+ info.setConsumerTTL(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ NetworkBridgeFilter info = (NetworkBridgeFilter) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
+ dataOut.writeInt(info.getMessageTTL());
+ dataOut.writeInt(info.getConsumerTTL());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBlobMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..bac94d8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBytesMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..fc869ce
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireDestinationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..abac42c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireDestinationMarshaller.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.v10;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMapMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..1bd16d5
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..4217663
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireObjectMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..5adfb7d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireQueueMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..1f8d78b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireStreamMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..1e1d858
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempDestinationMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..b1f4418
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v10;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempQueueMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempQueueMarshaller.java
new file mode 100644
index 0000000..7e20932
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempQueue;
+
+public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempTopicMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempTopicMarshaller.java
new file mode 100644
index 0000000..41d3c0a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTempTopic;
+
+public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTempTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTempTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[23/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..5afd72b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/TransactionInfoMarshaller.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.v2;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..b56f13b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..07b0aa6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v2;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BaseCommandMarshaller.java
new file mode 100644
index 0000000..bfa2899
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/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.v3;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerIdMarshaller.java
new file mode 100644
index 0000000..7db36e8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerIdMarshaller.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.v3;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..633951b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v3;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..36d52dd
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionControlMarshaller.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.v3;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..a9d4da6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/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.v3;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..bcea49a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/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.v3;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..44706f9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConnectionInfoMarshaller.java
@@ -0,0 +1,174 @@
+/**
+ * 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.v3;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat,dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(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());
+ bs.writeBoolean(info.isClientMaster());
+
+ 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();
+ 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((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for( int i=0; i < size; i++ ) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat,dataIn);
+ }
+ info.setBrokerPath(value);
+ }
+ else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(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());
+ dataOut.writeBoolean(info.isClientMaster());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..e1aa713
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..78b0eec
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/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.v3;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..2fe3741
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ConsumerInfoMarshaller.java
@@ -0,0 +1,223 @@
+/**
+ * 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.v3;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ControlCommandMarshaller.java
new file mode 100644
index 0000000..6682c19
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v3/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v3;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
[09/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..be764f4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..548013b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageIdMarshaller.java
new file mode 100644
index 0000000..fd42a5f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageMarshaller.java
new file mode 100644
index 0000000..3e90ac6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessageMarshaller.java
@@ -0,0 +1,304 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessagePullMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessagePullMarshaller.java
new file mode 100644
index 0000000..9e09e20
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v6;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..19224da
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v6;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBlobMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..1766994
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..64c6048
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..8e8d8ef
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireDestinationMarshaller.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.v6;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..5ba95e8
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..fd6a4d9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..c582441
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..4a73971
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireStreamMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..b6c31b1
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v6;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..e9fac68
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v6/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v6;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[51/51] [partial] git commit:
https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
https://issues.apache.org/jira/browse/OPENWIRE-1
An initial break out of the OpenWire protocol into it's own project.
Project: http://git-wip-us.apache.org/repos/asf/activemq-openwire/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-openwire/commit/7ae454fa
Tree: http://git-wip-us.apache.org/repos/asf/activemq-openwire/tree/7ae454fa
Diff: http://git-wip-us.apache.org/repos/asf/activemq-openwire/diff/7ae454fa
Branch: refs/heads/master
Commit: 7ae454faec8209cc46d2ca7b4b2606748f9c3310
Parents: 455e192
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu Jul 24 10:22:24 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu Jul 24 10:22:24 2014 -0400
----------------------------------------------------------------------
openwire-core/.gitignore | 1 +
openwire-core/pom.xml | 198 ++++
.../codec/BaseDataStreamMarshaller.java | 618 ++++++++++++
.../activemq/openwire/codec/BooleanStream.java | 120 +++
.../openwire/codec/DataStreamMarshaller.java | 41 +
.../openwire/codec/OpenWireConstants.java | 105 ++
.../activemq/openwire/codec/OpenWireFormat.java | 599 +++++++++++
.../openwire/codec/OpenWireFormatFactory.java | 159 +++
.../codec/v1/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v1/BrokerIdMarshaller.java | 118 +++
.../openwire/codec/v1/BrokerInfoMarshaller.java | 175 ++++
.../codec/v1/ConnectionControlMarshaller.java | 144 +++
.../codec/v1/ConnectionErrorMarshaller.java | 129 +++
.../codec/v1/ConnectionIdMarshaller.java | 124 +++
.../codec/v1/ConnectionInfoMarshaller.java | 189 ++++
.../codec/v1/ConsumerControlMarshaller.java | 148 +++
.../openwire/codec/v1/ConsumerIdMarshaller.java | 134 +++
.../codec/v1/ConsumerInfoMarshaller.java | 222 +++++
.../codec/v1/ControlCommandMarshaller.java | 123 +++
.../codec/v1/DataArrayResponseMarshaller.java | 143 +++
.../codec/v1/DataResponseMarshaller.java | 123 +++
.../v1/DataStructureSupportMarshaller.java | 88 ++
.../codec/v1/DestinationInfoMarshaller.java | 164 +++
.../codec/v1/DiscoveryEventMarshaller.java | 129 +++
.../codec/v1/ExceptionResponseMarshaller.java | 123 +++
.../codec/v1/FlushCommandMarshaller.java | 107 ++
.../codec/v1/IntegerResponseMarshaller.java | 119 +++
.../codec/v1/JournalQueueAckMarshaller.java | 130 +++
.../codec/v1/JournalTopicAckMarshaller.java | 150 +++
.../codec/v1/JournalTraceMarshaller.java | 124 +++
.../codec/v1/JournalTransactionMarshaller.java | 133 +++
.../codec/v1/KeepAliveInfoMarshaller.java | 107 ++
.../codec/v1/LastPartialCommandMarshaller.java | 107 ++
.../codec/v1/LocalTransactionIdMarshaller.java | 128 +++
.../openwire/codec/v1/MarshallerFactory.java | 95 ++
.../openwire/codec/v1/MessageAckMarshaller.java | 152 +++
.../codec/v1/MessageDispatchMarshaller.java | 139 +++
.../MessageDispatchNotificationMarshaller.java | 140 +++
.../openwire/codec/v1/MessageIdMarshaller.java | 134 +++
.../openwire/codec/v1/MessageMarshaller.java | 258 +++++
.../codec/v1/NetworkBridgeFilterMarshaller.java | 129 +++
.../v1/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v1/OpenWireDestinationMarshaller.java | 107 ++
.../codec/v1/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v1/OpenWireMessageMarshaller.java | 107 ++
.../v1/OpenWireObjectMessageMarshaller.java | 107 ++
.../codec/v1/OpenWireQueueMarshaller.java | 107 ++
.../v1/OpenWireStreamMessageMarshaller.java | 107 ++
.../v1/OpenWireTempDestinationMarshaller.java | 87 ++
.../codec/v1/OpenWireTempQueueMarshaller.java | 107 ++
.../codec/v1/OpenWireTempTopicMarshaller.java | 107 ++
.../codec/v1/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v1/OpenWireTopicMarshaller.java | 107 ++
.../codec/v1/PartialCommandMarshaller.java | 128 +++
.../openwire/codec/v1/ProducerIdMarshaller.java | 134 +++
.../codec/v1/ProducerInfoMarshaller.java | 156 +++
.../openwire/codec/v1/RemoveInfoMarshaller.java | 123 +++
.../v1/RemoveSubscriptionInfoMarshaller.java | 134 +++
.../codec/v1/ReplayCommandMarshaller.java | 124 +++
.../openwire/codec/v1/ResponseMarshaller.java | 119 +++
.../openwire/codec/v1/SessionIdMarshaller.java | 130 +++
.../codec/v1/SessionInfoMarshaller.java | 124 +++
.../codec/v1/ShutdownInfoMarshaller.java | 107 ++
.../codec/v1/SubscriptionInfoMarshaller.java | 140 +++
.../codec/v1/TransactionIdMarshaller.java | 88 ++
.../codec/v1/TransactionInfoMarshaller.java | 134 +++
.../codec/v1/WireFormatInfoMarshaller.java | 150 +++
.../codec/v1/XATransactionIdMarshaller.java | 138 +++
.../codec/v10/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v10/BrokerIdMarshaller.java | 124 +++
.../codec/v10/BrokerInfoMarshaller.java | 199 ++++
.../codec/v10/ConnectionControlMarshaller.java | 163 +++
.../codec/v10/ConnectionErrorMarshaller.java | 129 +++
.../codec/v10/ConnectionIdMarshaller.java | 124 +++
.../codec/v10/ConnectionInfoMarshaller.java | 195 ++++
.../codec/v10/ConsumerControlMarshaller.java | 154 +++
.../codec/v10/ConsumerIdMarshaller.java | 134 +++
.../codec/v10/ConsumerInfoMarshaller.java | 253 +++++
.../codec/v10/ControlCommandMarshaller.java | 123 +++
.../codec/v10/DataArrayResponseMarshaller.java | 144 +++
.../codec/v10/DataResponseMarshaller.java | 123 +++
.../codec/v10/DestinationInfoMarshaller.java | 165 +++
.../codec/v10/DiscoveryEventMarshaller.java | 129 +++
.../codec/v10/ExceptionResponseMarshaller.java | 123 +++
.../codec/v10/FlushCommandMarshaller.java | 108 ++
.../codec/v10/IntegerResponseMarshaller.java | 119 +++
.../codec/v10/JournalQueueAckMarshaller.java | 131 +++
.../codec/v10/JournalTopicAckMarshaller.java | 152 +++
.../codec/v10/JournalTraceMarshaller.java | 124 +++
.../codec/v10/JournalTransactionMarshaller.java | 134 +++
.../codec/v10/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v10/LastPartialCommandMarshaller.java | 108 ++
.../codec/v10/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v10/MarshallerFactory.java | 95 ++
.../codec/v10/MessageAckMarshaller.java | 160 +++
.../codec/v10/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v10/MessageIdMarshaller.java | 140 +++
.../openwire/codec/v10/MessageMarshaller.java | 309 ++++++
.../codec/v10/MessagePullMarshaller.java | 146 +++
.../v10/NetworkBridgeFilterMarshaller.java | 133 +++
.../v10/OpenWireBlobMessageMarshaller.java | 133 +++
.../v10/OpenWireBytesMessageMarshaller.java | 107 ++
.../v10/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v10/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v10/OpenWireMessageMarshaller.java | 107 ++
.../v10/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v10/OpenWireQueueMarshaller.java | 108 ++
.../v10/OpenWireStreamMessageMarshaller.java | 108 ++
.../v10/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v10/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v10/OpenWireTempTopicMarshaller.java | 108 ++
.../v10/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v10/OpenWireTopicMarshaller.java | 108 ++
.../codec/v10/PartialCommandMarshaller.java | 128 +++
.../codec/v10/ProducerAckMarshaller.java | 128 +++
.../codec/v10/ProducerIdMarshaller.java | 134 +++
.../codec/v10/ProducerInfoMarshaller.java | 165 +++
.../codec/v10/RemoveInfoMarshaller.java | 128 +++
.../v10/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v10/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v10/ResponseMarshaller.java | 118 +++
.../openwire/codec/v10/SessionIdMarshaller.java | 129 +++
.../codec/v10/SessionInfoMarshaller.java | 124 +++
.../codec/v10/ShutdownInfoMarshaller.java | 107 ++
.../codec/v10/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v10/TransactionIdMarshaller.java | 88 ++
.../codec/v10/TransactionInfoMarshaller.java | 134 +++
.../codec/v10/WireFormatInfoMarshaller.java | 149 +++
.../codec/v10/XATransactionIdMarshaller.java | 132 +++
.../codec/v9/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v9/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v9/BrokerInfoMarshaller.java | 199 ++++
.../codec/v9/ConnectionControlMarshaller.java | 163 +++
.../codec/v9/ConnectionErrorMarshaller.java | 129 +++
.../codec/v9/ConnectionIdMarshaller.java | 124 +++
.../codec/v9/ConnectionInfoMarshaller.java | 195 ++++
.../codec/v9/ConsumerControlMarshaller.java | 154 +++
.../openwire/codec/v9/ConsumerIdMarshaller.java | 134 +++
.../codec/v9/ConsumerInfoMarshaller.java | 248 +++++
.../codec/v9/ControlCommandMarshaller.java | 123 +++
.../codec/v9/DataArrayResponseMarshaller.java | 144 +++
.../codec/v9/DataResponseMarshaller.java | 123 +++
.../codec/v9/DestinationInfoMarshaller.java | 165 +++
.../codec/v9/DiscoveryEventMarshaller.java | 129 +++
.../codec/v9/ExceptionResponseMarshaller.java | 123 +++
.../codec/v9/FlushCommandMarshaller.java | 108 ++
.../codec/v9/IntegerResponseMarshaller.java | 119 +++
.../codec/v9/JournalQueueAckMarshaller.java | 131 +++
.../codec/v9/JournalTopicAckMarshaller.java | 152 +++
.../codec/v9/JournalTraceMarshaller.java | 124 +++
.../codec/v9/JournalTransactionMarshaller.java | 134 +++
.../codec/v9/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v9/LastPartialCommandMarshaller.java | 108 ++
.../codec/v9/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v9/MarshallerFactory.java | 95 ++
.../openwire/codec/v9/MessageAckMarshaller.java | 160 +++
.../codec/v9/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v9/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v9/MessageMarshaller.java | 304 ++++++
.../codec/v9/MessagePullMarshaller.java | 146 +++
.../codec/v9/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v9/OpenWireBlobMessageMarshaller.java | 133 +++
.../v9/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v9/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v9/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v9/OpenWireMessageMarshaller.java | 107 ++
.../v9/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v9/OpenWireQueueMarshaller.java | 108 ++
.../v9/OpenWireStreamMessageMarshaller.java | 108 ++
.../v9/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v9/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v9/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v9/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v9/OpenWireTopicMarshaller.java | 108 ++
.../codec/v9/PartialCommandMarshaller.java | 128 +++
.../codec/v9/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v9/ProducerIdMarshaller.java | 134 +++
.../codec/v9/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v9/RemoveInfoMarshaller.java | 128 +++
.../v9/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v9/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v9/ResponseMarshaller.java | 118 +++
.../openwire/codec/v9/SessionIdMarshaller.java | 129 +++
.../codec/v9/SessionInfoMarshaller.java | 124 +++
.../codec/v9/ShutdownInfoMarshaller.java | 107 ++
.../codec/v9/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v9/TransactionIdMarshaller.java | 88 ++
.../codec/v9/TransactionInfoMarshaller.java | 134 +++
.../codec/v9/WireFormatInfoMarshaller.java | 149 +++
.../codec/v9/XATransactionIdMarshaller.java | 132 +++
.../activemq/openwire/commands/BaseCommand.java | 132 +++
.../activemq/openwire/commands/BrokerId.java | 76 ++
.../activemq/openwire/commands/BrokerInfo.java | 236 +++++
.../activemq/openwire/commands/Command.java | 64 ++
.../openwire/commands/CommandTypes.java | 142 +++
.../openwire/commands/CommandVisitor.java | 89 ++
.../commands/CommandVisitorAdapter.java | 190 ++++
.../openwire/commands/ConnectionControl.java | 187 ++++
.../openwire/commands/ConnectionError.java | 60 ++
.../openwire/commands/ConnectionId.java | 98 ++
.../openwire/commands/ConnectionInfo.java | 228 +++++
.../openwire/commands/ConsumerControl.java | 147 +++
.../activemq/openwire/commands/ConsumerId.java | 137 +++
.../openwire/commands/ConsumerInfo.java | 447 +++++++++
.../openwire/commands/ControlCommand.java | 50 +
.../openwire/commands/DataArrayResponse.java | 50 +
.../openwire/commands/DataResponse.java | 50 +
.../openwire/commands/DataStructure.java | 40 +
.../openwire/commands/DestinationInfo.java | 138 +++
.../openwire/commands/DiscoveryEvent.java | 74 ++
.../openwire/commands/ExceptionResponse.java | 55 +
.../openwire/commands/FlushCommand.java | 38 +
.../openwire/commands/IntegerResponse.java | 50 +
.../openwire/commands/JournalQueueAck.java | 65 ++
.../openwire/commands/JournalTopicAck.java | 113 +++
.../openwire/commands/JournalTrace.java | 63 ++
.../openwire/commands/JournalTransaction.java | 92 ++
.../openwire/commands/KeepAliveInfo.java | 85 ++
.../openwire/commands/LastPartialCommand.java | 40 +
.../openwire/commands/LocalTransactionId.java | 125 +++
.../openwire/commands/MarshallAware.java | 33 +
.../activemq/openwire/commands/Message.java | 718 ++++++++++++++
.../activemq/openwire/commands/MessageAck.java | 254 +++++
.../openwire/commands/MessageDispatch.java | 89 ++
.../commands/MessageDispatchNotification.java | 89 ++
.../activemq/openwire/commands/MessageId.java | 202 ++++
.../activemq/openwire/commands/MessagePull.java | 124 +++
.../openwire/commands/NetworkBridgeFilter.java | 96 ++
.../openwire/commands/OpenWireBlobMessage.java | 149 +++
.../openwire/commands/OpenWireBytesMessage.java | 197 ++++
.../openwire/commands/OpenWireDestination.java | 396 ++++++++
.../openwire/commands/OpenWireMapMessage.java | 296 ++++++
.../openwire/commands/OpenWireMessage.java | 405 ++++++++
.../commands/OpenWireObjectMessage.java | 197 ++++
.../openwire/commands/OpenWireQueue.java | 61 ++
.../commands/OpenWireStreamMessage.java | 229 +++++
.../commands/OpenWireTempDestination.java | 96 ++
.../openwire/commands/OpenWireTempQueue.java | 71 ++
.../openwire/commands/OpenWireTempTopic.java | 69 ++
.../openwire/commands/OpenWireTextMessage.java | 183 ++++
.../openwire/commands/OpenWireTopic.java | 60 ++
.../openwire/commands/PartialCommand.java | 158 +++
.../activemq/openwire/commands/ProducerAck.java | 83 ++
.../activemq/openwire/commands/ProducerId.java | 151 +++
.../openwire/commands/ProducerInfo.java | 141 +++
.../activemq/openwire/commands/RemoveInfo.java | 110 ++
.../commands/RemoveSubscriptionInfo.java | 82 ++
.../openwire/commands/ReplayCommand.java | 121 +++
.../activemq/openwire/commands/Response.java | 56 ++
.../activemq/openwire/commands/SessionId.java | 122 +++
.../activemq/openwire/commands/SessionInfo.java | 71 ++
.../openwire/commands/ShutdownInfo.java | 40 +
.../openwire/commands/SubscriptionInfo.java | 154 +++
.../openwire/commands/TransactionId.java | 32 +
.../openwire/commands/TransactionInfo.java | 111 +++
.../openwire/commands/WireFormatInfo.java | 395 ++++++++
.../openwire/commands/XATransactionId.java | 257 +++++
.../activemq/openwire/commands/package.html | 24 +
.../activemq/openwire/utils/CronParser.java | 357 +++++++
...DefaultUnresolvedDestinationTransformer.java | 71 ++
.../openwire/utils/ExceptionSupport.java | 103 ++
.../utils/ObjectMessageInputStream.java | 150 +++
.../openwire/utils/OpenWireConnection.java | 156 +++
.../openwire/utils/OpenWireConsumer.java | 108 ++
.../openwire/utils/OpenWireIdGenerator.java | 250 +++++
.../utils/OpenWireMarshallingSupport.java | 439 ++++++++
.../openwire/utils/OpenWireProducer.java | 123 +++
.../openwire/utils/OpenWireSession.java | 130 +++
.../utils/UnresolvedDestinationTransformer.java | 57 ++
.../openwire/codec/BooleanStreamTest.java | 156 +++
.../codec/NumberRangesWhileMarshallingTest.java | 146 +++
.../commands/DataStructureTestSupport.java | 143 +++
.../activemq/openwire/commands/MessageTest.java | 112 +++
.../commands/OpenWireBytesMessageTest.java | 76 ++
.../commands/OpenWireDestinationTest.java | 135 +++
.../commands/OpenWireMapMessageTest.java | 211 ++++
.../openwire/commands/OpenWireMessageTest.java | 461 +++++++++
.../commands/OpenWireObjectMessageTest.java | 68 ++
.../commands/OpenWireStreamMessageTest.java | 116 +++
.../commands/OpenWireTextMessageTest.java | 131 +++
.../openwire/ide/OpenWireCodecGenerator.java | 121 +++
.../activemq/openwire/utils/CronParserTest.java | 363 +++++++
.../utils/OpenWireMarshallingSupportTest.java | 43 +
.../src/test/resources/log4j.properties | 41 +
openwire-generator/.gitignore | 1 +
openwire-generator/pom.xml | 95 ++
.../openwire/generator/GeneratorTask.java | 206 ++++
.../generator/MarshallingGenerator.java | 712 +++++++++++++
.../generator/MultiSourceGenerator.java | 265 +++++
.../openwire/generator/OpenWireGenerator.java | 178 ++++
.../openwire/generator/TestDataGenerator.java | 66 ++
.../openwire/generator/TestsGenerator.java | 198 ++++
openwire-interop-tests/.gitignore | 1 +
openwire-interop-tests/pom.xml | 93 ++
.../openwire/codec/MessageCompressionTest.java | 438 ++++++++
.../codec/OpenWireInteropTestSupport.java | 265 +++++
.../openwire/codec/OpenWireInteropTests.java | 241 +++++
.../codec/WireFormatInfoMarshaledSizeTest.java | 215 ++++
.../openwire/codec/v1/OpenWireV1Test.java | 34 +
.../v1/WireFormatInfoV1MarshaledSizeTest.java | 30 +
.../openwire/codec/v10/OpenWireV10Test.java | 34 +
.../v10/WireFormatInfoV10MarshaledSizeTest.java | 30 +
.../openwire/codec/v2/OpenWireV2Test.java | 34 +
.../v2/WireFormatInfoV2MarshaledSizeTest.java | 30 +
.../openwire/codec/v3/OpenWireV3Test.java | 34 +
.../v3/WireFormatInfoV3MarshaledSizeTest.java | 30 +
.../openwire/codec/v4/OpenWireV4Test.java | 34 +
.../v4/WireFormatInfoV4MarshaledSizeTest.java | 30 +
.../openwire/codec/v5/OpenWireV5Test.java | 34 +
.../v5/WireFormatInfoV5MarshaledSizeTest.java | 30 +
.../openwire/codec/v6/OpenWireV6Test.java | 34 +
.../v6/WireFormatInfoV6MarshaledSizeTest.java | 30 +
.../openwire/codec/v7/OpenWireV7Test.java | 34 +
.../v7/WireFormatInfoV7MarshaledSizeTest.java | 30 +
.../openwire/codec/v8/OpenWireV8Test.java | 34 +
.../v8/WireFormatInfoV8MarshaledSizeTest.java | 30 +
.../openwire/codec/v9/OpenWireV9Test.java | 34 +
.../v9/WireFormatInfoV9MarshaledSizeTest.java | 30 +
.../activemq/openwire/util/TcpTransport.java | 414 ++++++++
.../openwire/util/TransportListener.java | 52 +
.../org/apache/activemq/openwire/util/Wait.java | 48 +
.../src/test/resources/log4j.properties | 41 +
openwire-jms/.gitignore | 1 +
openwire-jms/pom.xml | 89 ++
.../openwire/jms/OpenWireJMSBytesMessage.java | 783 +++++++++++++++
.../openwire/jms/OpenWireJMSMapMessage.java | 324 ++++++
.../openwire/jms/OpenWireJMSMessage.java | 561 +++++++++++
.../openwire/jms/OpenWireJMSObjectMessage.java | 72 ++
.../openwire/jms/OpenWireJMSStreamMessage.java | 710 +++++++++++++
.../openwire/jms/OpenWireJMSTextMessage.java | 78 ++
.../utils/OpenWireMessagePropertyGetter.java | 339 +++++++
.../utils/OpenWireMessagePropertySetter.java | 305 ++++++
.../jms/utils/TypeConversionSupport.java | 255 +++++
.../jms/OpenWireJMSBytesMessageTest.java | 487 +++++++++
.../openwire/jms/OpenWireJMSMapMessageTest.java | 488 +++++++++
.../openwire/jms/OpenWireJMSMessageTest.java | 991 +++++++++++++++++++
.../jms/OpenWireJMSObjectMessageTest.java | 110 ++
.../jms/OpenWireJMSStreamMessageTest.java | 938 ++++++++++++++++++
.../jms/OpenWireJMSTextMessageTest.java | 97 ++
.../src/test/resources/log4j.properties | 41 +
openwire-legacy/.gitignore | 1 +
openwire-legacy/pom.xml | 62 ++
.../codec/v2/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v2/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v2/BrokerInfoMarshaller.java | 189 ++++
.../codec/v2/ConnectionControlMarshaller.java | 134 +++
.../codec/v2/ConnectionErrorMarshaller.java | 129 +++
.../codec/v2/ConnectionIdMarshaller.java | 124 +++
.../codec/v2/ConnectionInfoMarshaller.java | 174 ++++
.../codec/v2/ConsumerControlMarshaller.java | 148 +++
.../openwire/codec/v2/ConsumerIdMarshaller.java | 134 +++
.../codec/v2/ConsumerInfoMarshaller.java | 223 +++++
.../codec/v2/ControlCommandMarshaller.java | 123 +++
.../codec/v2/DataArrayResponseMarshaller.java | 144 +++
.../codec/v2/DataResponseMarshaller.java | 123 +++
.../codec/v2/DestinationInfoMarshaller.java | 165 +++
.../codec/v2/DiscoveryEventMarshaller.java | 129 +++
.../codec/v2/ExceptionResponseMarshaller.java | 123 +++
.../codec/v2/FlushCommandMarshaller.java | 108 ++
.../codec/v2/IntegerResponseMarshaller.java | 119 +++
.../codec/v2/JournalQueueAckMarshaller.java | 131 +++
.../codec/v2/JournalTopicAckMarshaller.java | 152 +++
.../codec/v2/JournalTraceMarshaller.java | 124 +++
.../codec/v2/JournalTransactionMarshaller.java | 134 +++
.../codec/v2/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v2/LastPartialCommandMarshaller.java | 108 ++
.../codec/v2/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v2/MarshallerFactory.java | 93 ++
.../openwire/codec/v2/MessageAckMarshaller.java | 155 +++
.../codec/v2/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v2/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v2/MessageMarshaller.java | 269 +++++
.../codec/v2/MessagePullMarshaller.java | 135 +++
.../codec/v2/NetworkBridgeFilterMarshaller.java | 1 +
.../v2/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v2/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v2/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v2/OpenWireMessageMarshaller.java | 107 ++
.../v2/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v2/OpenWireQueueMarshaller.java | 108 ++
.../v2/OpenWireStreamMessageMarshaller.java | 108 ++
.../v2/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v2/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v2/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v2/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v2/OpenWireTopicMarshaller.java | 108 ++
.../codec/v2/PartialCommandMarshaller.java | 128 +++
.../openwire/codec/v2/ProducerIdMarshaller.java | 134 +++
.../codec/v2/ProducerInfoMarshaller.java | 161 +++
.../openwire/codec/v2/RemoveInfoMarshaller.java | 123 +++
.../v2/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v2/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v2/ResponseMarshaller.java | 118 +++
.../openwire/codec/v2/SessionIdMarshaller.java | 129 +++
.../codec/v2/SessionInfoMarshaller.java | 124 +++
.../codec/v2/ShutdownInfoMarshaller.java | 107 ++
.../codec/v2/SubscriptionInfoMarshaller.java | 140 +++
.../codec/v2/TransactionIdMarshaller.java | 88 ++
.../codec/v2/TransactionInfoMarshaller.java | 134 +++
.../codec/v2/WireFormatInfoMarshaller.java | 149 +++
.../codec/v2/XATransactionIdMarshaller.java | 132 +++
.../codec/v3/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v3/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v3/BrokerInfoMarshaller.java | 199 ++++
.../codec/v3/ConnectionControlMarshaller.java | 134 +++
.../codec/v3/ConnectionErrorMarshaller.java | 129 +++
.../codec/v3/ConnectionIdMarshaller.java | 124 +++
.../codec/v3/ConnectionInfoMarshaller.java | 174 ++++
.../codec/v3/ConsumerControlMarshaller.java | 148 +++
.../openwire/codec/v3/ConsumerIdMarshaller.java | 134 +++
.../codec/v3/ConsumerInfoMarshaller.java | 223 +++++
.../codec/v3/ControlCommandMarshaller.java | 123 +++
.../codec/v3/DataArrayResponseMarshaller.java | 144 +++
.../codec/v3/DataResponseMarshaller.java | 123 +++
.../codec/v3/DestinationInfoMarshaller.java | 165 +++
.../codec/v3/DiscoveryEventMarshaller.java | 129 +++
.../codec/v3/ExceptionResponseMarshaller.java | 123 +++
.../codec/v3/FlushCommandMarshaller.java | 108 ++
.../codec/v3/IntegerResponseMarshaller.java | 119 +++
.../codec/v3/JournalQueueAckMarshaller.java | 131 +++
.../codec/v3/JournalTopicAckMarshaller.java | 152 +++
.../codec/v3/JournalTraceMarshaller.java | 124 +++
.../codec/v3/JournalTransactionMarshaller.java | 134 +++
.../codec/v3/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v3/LastPartialCommandMarshaller.java | 108 ++
.../codec/v3/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v3/MarshallerFactory.java | 95 ++
.../openwire/codec/v3/MessageAckMarshaller.java | 155 +++
.../codec/v3/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v3/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v3/MessageMarshaller.java | 304 ++++++
.../codec/v3/MessagePullMarshaller.java | 146 +++
.../codec/v3/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v3/OpenWireBlobMessageMarshaller.java | 133 +++
.../v3/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v3/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v3/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v3/OpenWireMessageMarshaller.java | 107 ++
.../v3/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v3/OpenWireQueueMarshaller.java | 108 ++
.../v3/OpenWireStreamMessageMarshaller.java | 108 ++
.../v3/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v3/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v3/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v3/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v3/OpenWireTopicMarshaller.java | 108 ++
.../codec/v3/PartialCommandMarshaller.java | 128 +++
.../codec/v3/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v3/ProducerIdMarshaller.java | 134 +++
.../codec/v3/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v3/RemoveInfoMarshaller.java | 123 +++
.../v3/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v3/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v3/ResponseMarshaller.java | 118 +++
.../openwire/codec/v3/SessionIdMarshaller.java | 129 +++
.../codec/v3/SessionInfoMarshaller.java | 124 +++
.../codec/v3/ShutdownInfoMarshaller.java | 107 ++
.../codec/v3/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v3/TransactionIdMarshaller.java | 88 ++
.../codec/v3/TransactionInfoMarshaller.java | 134 +++
.../codec/v3/WireFormatInfoMarshaller.java | 149 +++
.../codec/v3/XATransactionIdMarshaller.java | 132 +++
.../codec/v4/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v4/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v4/BrokerInfoMarshaller.java | 199 ++++
.../codec/v4/ConnectionControlMarshaller.java | 134 +++
.../codec/v4/ConnectionErrorMarshaller.java | 129 +++
.../codec/v4/ConnectionIdMarshaller.java | 124 +++
.../codec/v4/ConnectionInfoMarshaller.java | 174 ++++
.../codec/v4/ConsumerControlMarshaller.java | 148 +++
.../openwire/codec/v4/ConsumerIdMarshaller.java | 134 +++
.../codec/v4/ConsumerInfoMarshaller.java | 248 +++++
.../codec/v4/ControlCommandMarshaller.java | 123 +++
.../codec/v4/DataArrayResponseMarshaller.java | 144 +++
.../codec/v4/DataResponseMarshaller.java | 123 +++
.../codec/v4/DestinationInfoMarshaller.java | 165 +++
.../codec/v4/DiscoveryEventMarshaller.java | 129 +++
.../codec/v4/ExceptionResponseMarshaller.java | 123 +++
.../codec/v4/FlushCommandMarshaller.java | 108 ++
.../codec/v4/IntegerResponseMarshaller.java | 119 +++
.../codec/v4/JournalQueueAckMarshaller.java | 131 +++
.../codec/v4/JournalTopicAckMarshaller.java | 152 +++
.../codec/v4/JournalTraceMarshaller.java | 124 +++
.../codec/v4/JournalTransactionMarshaller.java | 134 +++
.../codec/v4/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v4/LastPartialCommandMarshaller.java | 108 ++
.../codec/v4/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v4/MarshallerFactory.java | 95 ++
.../openwire/codec/v4/MessageAckMarshaller.java | 155 +++
.../codec/v4/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v4/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v4/MessageMarshaller.java | 304 ++++++
.../codec/v4/MessagePullMarshaller.java | 146 +++
.../codec/v4/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v4/OpenWireBlobMessageMarshaller.java | 133 +++
.../v4/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v4/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v4/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v4/OpenWireMessageMarshaller.java | 107 ++
.../v4/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v4/OpenWireQueueMarshaller.java | 108 ++
.../v4/OpenWireStreamMessageMarshaller.java | 108 ++
.../v4/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v4/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v4/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v4/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v4/OpenWireTopicMarshaller.java | 108 ++
.../codec/v4/PartialCommandMarshaller.java | 128 +++
.../codec/v4/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v4/ProducerIdMarshaller.java | 134 +++
.../codec/v4/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v4/RemoveInfoMarshaller.java | 123 +++
.../v4/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v4/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v4/ResponseMarshaller.java | 118 +++
.../openwire/codec/v4/SessionIdMarshaller.java | 129 +++
.../codec/v4/SessionInfoMarshaller.java | 124 +++
.../codec/v4/ShutdownInfoMarshaller.java | 107 ++
.../codec/v4/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v4/TransactionIdMarshaller.java | 88 ++
.../codec/v4/TransactionInfoMarshaller.java | 134 +++
.../codec/v4/WireFormatInfoMarshaller.java | 149 +++
.../codec/v4/XATransactionIdMarshaller.java | 132 +++
.../codec/v5/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v5/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v5/BrokerInfoMarshaller.java | 199 ++++
.../codec/v5/ConnectionControlMarshaller.java | 134 +++
.../codec/v5/ConnectionErrorMarshaller.java | 129 +++
.../codec/v5/ConnectionIdMarshaller.java | 124 +++
.../codec/v5/ConnectionInfoMarshaller.java | 174 ++++
.../codec/v5/ConsumerControlMarshaller.java | 148 +++
.../openwire/codec/v5/ConsumerIdMarshaller.java | 134 +++
.../codec/v5/ConsumerInfoMarshaller.java | 248 +++++
.../codec/v5/ControlCommandMarshaller.java | 123 +++
.../codec/v5/DataArrayResponseMarshaller.java | 144 +++
.../codec/v5/DataResponseMarshaller.java | 123 +++
.../codec/v5/DestinationInfoMarshaller.java | 165 +++
.../codec/v5/DiscoveryEventMarshaller.java | 129 +++
.../codec/v5/ExceptionResponseMarshaller.java | 123 +++
.../codec/v5/FlushCommandMarshaller.java | 108 ++
.../codec/v5/IntegerResponseMarshaller.java | 119 +++
.../codec/v5/JournalQueueAckMarshaller.java | 131 +++
.../codec/v5/JournalTopicAckMarshaller.java | 152 +++
.../codec/v5/JournalTraceMarshaller.java | 124 +++
.../codec/v5/JournalTransactionMarshaller.java | 134 +++
.../codec/v5/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v5/LastPartialCommandMarshaller.java | 108 ++
.../codec/v5/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v5/MarshallerFactory.java | 95 ++
.../openwire/codec/v5/MessageAckMarshaller.java | 155 +++
.../codec/v5/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v5/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v5/MessageMarshaller.java | 304 ++++++
.../codec/v5/MessagePullMarshaller.java | 146 +++
.../codec/v5/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v5/OpenWireBlobMessageMarshaller.java | 133 +++
.../v5/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v5/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v5/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v5/OpenWireMessageMarshaller.java | 107 ++
.../v5/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v5/OpenWireQueueMarshaller.java | 108 ++
.../v5/OpenWireStreamMessageMarshaller.java | 108 ++
.../v5/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v5/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v5/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v5/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v5/OpenWireTopicMarshaller.java | 108 ++
.../codec/v5/PartialCommandMarshaller.java | 128 +++
.../codec/v5/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v5/ProducerIdMarshaller.java | 134 +++
.../codec/v5/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v5/RemoveInfoMarshaller.java | 128 +++
.../v5/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v5/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v5/ResponseMarshaller.java | 118 +++
.../openwire/codec/v5/SessionIdMarshaller.java | 129 +++
.../codec/v5/SessionInfoMarshaller.java | 124 +++
.../codec/v5/ShutdownInfoMarshaller.java | 107 ++
.../codec/v5/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v5/TransactionIdMarshaller.java | 88 ++
.../codec/v5/TransactionInfoMarshaller.java | 134 +++
.../codec/v5/WireFormatInfoMarshaller.java | 149 +++
.../codec/v5/XATransactionIdMarshaller.java | 132 +++
.../codec/v6/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v6/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v6/BrokerInfoMarshaller.java | 199 ++++
.../codec/v6/ConnectionControlMarshaller.java | 158 +++
.../codec/v6/ConnectionErrorMarshaller.java | 129 +++
.../codec/v6/ConnectionIdMarshaller.java | 124 +++
.../codec/v6/ConnectionInfoMarshaller.java | 190 ++++
.../codec/v6/ConsumerControlMarshaller.java | 154 +++
.../openwire/codec/v6/ConsumerIdMarshaller.java | 134 +++
.../codec/v6/ConsumerInfoMarshaller.java | 248 +++++
.../codec/v6/ControlCommandMarshaller.java | 123 +++
.../codec/v6/DataArrayResponseMarshaller.java | 144 +++
.../codec/v6/DataResponseMarshaller.java | 123 +++
.../codec/v6/DestinationInfoMarshaller.java | 165 +++
.../codec/v6/DiscoveryEventMarshaller.java | 129 +++
.../codec/v6/ExceptionResponseMarshaller.java | 123 +++
.../codec/v6/FlushCommandMarshaller.java | 108 ++
.../codec/v6/IntegerResponseMarshaller.java | 119 +++
.../codec/v6/JournalQueueAckMarshaller.java | 131 +++
.../codec/v6/JournalTopicAckMarshaller.java | 152 +++
.../codec/v6/JournalTraceMarshaller.java | 124 +++
.../codec/v6/JournalTransactionMarshaller.java | 134 +++
.../codec/v6/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v6/LastPartialCommandMarshaller.java | 108 ++
.../codec/v6/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v6/MarshallerFactory.java | 95 ++
.../openwire/codec/v6/MessageAckMarshaller.java | 155 +++
.../codec/v6/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v6/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v6/MessageMarshaller.java | 304 ++++++
.../codec/v6/MessagePullMarshaller.java | 146 +++
.../codec/v6/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v6/OpenWireBlobMessageMarshaller.java | 133 +++
.../v6/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v6/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v6/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v6/OpenWireMessageMarshaller.java | 107 ++
.../v6/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v6/OpenWireQueueMarshaller.java | 108 ++
.../v6/OpenWireStreamMessageMarshaller.java | 108 ++
.../v6/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v6/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v6/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v6/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v6/OpenWireTopicMarshaller.java | 108 ++
.../codec/v6/PartialCommandMarshaller.java | 128 +++
.../codec/v6/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v6/ProducerIdMarshaller.java | 134 +++
.../codec/v6/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v6/RemoveInfoMarshaller.java | 128 +++
.../v6/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v6/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v6/ResponseMarshaller.java | 118 +++
.../openwire/codec/v6/SessionIdMarshaller.java | 129 +++
.../codec/v6/SessionInfoMarshaller.java | 124 +++
.../codec/v6/ShutdownInfoMarshaller.java | 107 ++
.../codec/v6/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v6/TransactionIdMarshaller.java | 88 ++
.../codec/v6/TransactionInfoMarshaller.java | 134 +++
.../codec/v6/WireFormatInfoMarshaller.java | 149 +++
.../codec/v6/XATransactionIdMarshaller.java | 132 +++
.../codec/v7/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v7/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v7/BrokerInfoMarshaller.java | 199 ++++
.../codec/v7/ConnectionControlMarshaller.java | 158 +++
.../codec/v7/ConnectionErrorMarshaller.java | 129 +++
.../codec/v7/ConnectionIdMarshaller.java | 124 +++
.../codec/v7/ConnectionInfoMarshaller.java | 190 ++++
.../codec/v7/ConsumerControlMarshaller.java | 154 +++
.../openwire/codec/v7/ConsumerIdMarshaller.java | 134 +++
.../codec/v7/ConsumerInfoMarshaller.java | 248 +++++
.../codec/v7/ControlCommandMarshaller.java | 123 +++
.../codec/v7/DataArrayResponseMarshaller.java | 144 +++
.../codec/v7/DataResponseMarshaller.java | 123 +++
.../codec/v7/DestinationInfoMarshaller.java | 165 +++
.../codec/v7/DiscoveryEventMarshaller.java | 129 +++
.../codec/v7/ExceptionResponseMarshaller.java | 123 +++
.../codec/v7/FlushCommandMarshaller.java | 108 ++
.../codec/v7/IntegerResponseMarshaller.java | 119 +++
.../codec/v7/JournalQueueAckMarshaller.java | 131 +++
.../codec/v7/JournalTopicAckMarshaller.java | 152 +++
.../codec/v7/JournalTraceMarshaller.java | 124 +++
.../codec/v7/JournalTransactionMarshaller.java | 134 +++
.../codec/v7/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v7/LastPartialCommandMarshaller.java | 108 ++
.../codec/v7/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v7/MarshallerFactory.java | 95 ++
.../openwire/codec/v7/MessageAckMarshaller.java | 160 +++
.../codec/v7/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v7/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v7/MessageMarshaller.java | 304 ++++++
.../codec/v7/MessagePullMarshaller.java | 146 +++
.../codec/v7/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v7/OpenWireBlobMessageMarshaller.java | 133 +++
.../v7/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v7/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v7/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v7/OpenWireMessageMarshaller.java | 107 ++
.../v7/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v7/OpenWireQueueMarshaller.java | 108 ++
.../v7/OpenWireStreamMessageMarshaller.java | 108 ++
.../v7/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v7/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v7/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v7/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v7/OpenWireTopicMarshaller.java | 108 ++
.../codec/v7/PartialCommandMarshaller.java | 128 +++
.../codec/v7/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v7/ProducerIdMarshaller.java | 134 +++
.../codec/v7/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v7/RemoveInfoMarshaller.java | 128 +++
.../v7/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v7/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v7/ResponseMarshaller.java | 118 +++
.../openwire/codec/v7/SessionIdMarshaller.java | 129 +++
.../codec/v7/SessionInfoMarshaller.java | 124 +++
.../codec/v7/ShutdownInfoMarshaller.java | 107 ++
.../codec/v7/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v7/TransactionIdMarshaller.java | 88 ++
.../codec/v7/TransactionInfoMarshaller.java | 134 +++
.../codec/v7/WireFormatInfoMarshaller.java | 149 +++
.../codec/v7/XATransactionIdMarshaller.java | 132 +++
.../codec/v8/BaseCommandMarshaller.java | 109 ++
.../openwire/codec/v8/BrokerIdMarshaller.java | 124 +++
.../openwire/codec/v8/BrokerInfoMarshaller.java | 199 ++++
.../codec/v8/ConnectionControlMarshaller.java | 163 +++
.../codec/v8/ConnectionErrorMarshaller.java | 129 +++
.../codec/v8/ConnectionIdMarshaller.java | 124 +++
.../codec/v8/ConnectionInfoMarshaller.java | 195 ++++
.../codec/v8/ConsumerControlMarshaller.java | 154 +++
.../openwire/codec/v8/ConsumerIdMarshaller.java | 134 +++
.../codec/v8/ConsumerInfoMarshaller.java | 248 +++++
.../codec/v8/ControlCommandMarshaller.java | 123 +++
.../codec/v8/DataArrayResponseMarshaller.java | 144 +++
.../codec/v8/DataResponseMarshaller.java | 123 +++
.../codec/v8/DestinationInfoMarshaller.java | 165 +++
.../codec/v8/DiscoveryEventMarshaller.java | 129 +++
.../codec/v8/ExceptionResponseMarshaller.java | 123 +++
.../codec/v8/FlushCommandMarshaller.java | 108 ++
.../codec/v8/IntegerResponseMarshaller.java | 119 +++
.../codec/v8/JournalQueueAckMarshaller.java | 131 +++
.../codec/v8/JournalTopicAckMarshaller.java | 152 +++
.../codec/v8/JournalTraceMarshaller.java | 124 +++
.../codec/v8/JournalTransactionMarshaller.java | 134 +++
.../codec/v8/KeepAliveInfoMarshaller.java | 108 ++
.../codec/v8/LastPartialCommandMarshaller.java | 108 ++
.../codec/v8/LocalTransactionIdMarshaller.java | 129 +++
.../openwire/codec/v8/MarshallerFactory.java | 95 ++
.../openwire/codec/v8/MessageAckMarshaller.java | 160 +++
.../codec/v8/MessageDispatchMarshaller.java | 140 +++
.../MessageDispatchNotificationMarshaller.java | 141 +++
.../openwire/codec/v8/MessageIdMarshaller.java | 135 +++
.../openwire/codec/v8/MessageMarshaller.java | 304 ++++++
.../codec/v8/MessagePullMarshaller.java | 146 +++
.../codec/v8/NetworkBridgeFilterMarshaller.java | 1 +
.../codec/v8/OpenWireBlobMessageMarshaller.java | 133 +++
.../v8/OpenWireBytesMessageMarshaller.java | 107 ++
.../codec/v8/OpenWireDestinationMarshaller.java | 105 ++
.../codec/v8/OpenWireMapMessageMarshaller.java | 107 ++
.../codec/v8/OpenWireMessageMarshaller.java | 107 ++
.../v8/OpenWireObjectMessageMarshaller.java | 108 ++
.../codec/v8/OpenWireQueueMarshaller.java | 108 ++
.../v8/OpenWireStreamMessageMarshaller.java | 108 ++
.../v8/OpenWireTempDestinationMarshaller.java | 88 ++
.../codec/v8/OpenWireTempQueueMarshaller.java | 108 ++
.../codec/v8/OpenWireTempTopicMarshaller.java | 108 ++
.../codec/v8/OpenWireTextMessageMarshaller.java | 108 ++
.../codec/v8/OpenWireTopicMarshaller.java | 108 ++
.../codec/v8/PartialCommandMarshaller.java | 128 +++
.../codec/v8/ProducerAckMarshaller.java | 128 +++
.../openwire/codec/v8/ProducerIdMarshaller.java | 134 +++
.../codec/v8/ProducerInfoMarshaller.java | 165 +++
.../openwire/codec/v8/RemoveInfoMarshaller.java | 128 +++
.../v8/RemoveSubscriptionInfoMarshaller.java | 135 +++
.../codec/v8/ReplayCommandMarshaller.java | 123 +++
.../openwire/codec/v8/ResponseMarshaller.java | 118 +++
.../openwire/codec/v8/SessionIdMarshaller.java | 129 +++
.../codec/v8/SessionInfoMarshaller.java | 124 +++
.../codec/v8/ShutdownInfoMarshaller.java | 107 ++
.../codec/v8/SubscriptionInfoMarshaller.java | 145 +++
.../codec/v8/TransactionIdMarshaller.java | 88 ++
.../codec/v8/TransactionInfoMarshaller.java | 134 +++
.../codec/v8/WireFormatInfoMarshaller.java | 149 +++
.../codec/v8/XATransactionIdMarshaller.java | 132 +++
pom.xml | 220 ++++
777 files changed, 106747 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/.gitignore
----------------------------------------------------------------------
diff --git a/openwire-core/.gitignore b/openwire-core/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/openwire-core/.gitignore
@@ -0,0 +1 @@
+/target
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-core/pom.xml b/openwire-core/pom.xml
new file mode 100644
index 0000000..18d3573
--- /dev/null
+++ b/openwire-core/pom.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-protocol</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openwire-core</artifactId>
+ <name>openwire-core</name>
+ <description>The main OpenWire protocol implementation providing current versions of the codec.</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <openwire-src>${basedir}/src/main/java/io/openwire/commands</openwire-src>
+ <openwire-oldest>10</openwire-oldest>
+ <openwire-newest>10</openwire-newest>
+ </properties>
+
+ <dependencies>
+ <!-- =================================== -->
+ <!-- Required Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.fusesource.hawtbuf</groupId>
+ <artifactId>hawtbuf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </dependency>
+
+ <!-- =================================== -->
+ <!-- Testing Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-generator</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <version>${activemq-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-kahadb-store</artifactId>
+ <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>
+
+<!-- <build> -->
+<!-- <plugins> -->
+<!-- <plugin> -->
+<!-- <groupId>org.apache.maven.plugins</groupId> -->
+<!-- <artifactId>maven-antrun-plugin</artifactId> -->
+<!-- <executions> -->
+<!-- <execution> -->
+<!-- <id>default</id> -->
+<!-- <phase>generate-sources</phase> -->
+<!-- <configuration> -->
+<!-- <target> -->
+<!-- <echo>Running OpenWire Generator</echo> -->
+<!-- <taskdef name="generate" classname="org.apache.activemq.openwire.generator.GeneratorTask" classpathref="maven.test.classpath" /> -->
+<!-- <generate fromVersion="${openwire-oldest}" toVersion="${openwire-newest}" sourceDir="${openwire-src}" targetDir="${project.build.directory}/generated-sources/openwire" /> -->
+<!-- </target> -->
+<!-- </configuration> -->
+<!-- <goals> -->
+<!-- <goal>run</goal> -->
+<!-- </goals> -->
+<!-- </execution> -->
+<!-- </executions> -->
+<!-- </plugin> -->
+<!-- <plugin> -->
+<!-- <groupId>org.codehaus.mojo</groupId> -->
+<!-- <artifactId>build-helper-maven-plugin</artifactId> -->
+<!-- <version>1.7</version> -->
+<!-- <executions> -->
+<!-- <execution> -->
+<!-- <id>default</id> -->
+<!-- <phase>generate-sources</phase> -->
+<!-- <goals> -->
+<!-- <goal>add-source</goal> -->
+<!-- </goals> -->
+<!-- <configuration> -->
+<!-- <sources> -->
+<!-- <source>${project.build.directory}/generated-sources/openwire</source> -->
+<!-- </sources> -->
+<!-- </configuration> -->
+<!-- </execution> -->
+<!-- </executions> -->
+<!-- </plugin> -->
+<!-- </plugins> -->
+<!-- </build> -->
+
+<!-- <profiles> -->
+<!-- <profile> -->
+<!-- <id>lib/tools.jar</id> -->
+<!-- <activation> -->
+<!-- <file> -->
+<!-- <exists>${java.home}/lib/tools.jar</exists> -->
+<!-- </file> -->
+<!-- </activation> -->
+<!-- <build> -->
+<!-- <plugins> -->
+<!-- <plugin> -->
+<!-- <groupId>org.apache.maven.plugins</groupId> -->
+<!-- <artifactId>maven-antrun-plugin</artifactId> -->
+<!-- <dependencies> -->
+<!-- <dependency> -->
+<!-- <groupId>com.sun</groupId> -->
+<!-- <artifactId>tools</artifactId> -->
+<!-- <version>1.6.5</version> -->
+<!-- <scope>system</scope> -->
+<!-- <optional>true</optional> -->
+<!-- <systemPath>${java.home}/lib/tools.jar</systemPath> -->
+<!-- </dependency> -->
+<!-- </dependencies> -->
+<!-- </plugin> -->
+<!-- </plugins> -->
+<!-- </build> -->
+<!-- </profile> -->
+<!-- <profile> -->
+<!-- <id>../lib/tools.jar</id> -->
+<!-- <activation> -->
+<!-- <file> -->
+<!-- <exists>${java.home}/../lib/tools.jar</exists> -->
+<!-- </file> -->
+<!-- </activation> -->
+<!-- <build> -->
+<!-- <plugins> -->
+<!-- <plugin> -->
+<!-- <groupId>org.apache.maven.plugins</groupId> -->
+<!-- <artifactId>maven-antrun-plugin</artifactId> -->
+<!-- <dependencies> -->
+<!-- <dependency> -->
+<!-- <groupId>com.sun</groupId> -->
+<!-- <artifactId>tools</artifactId> -->
+<!-- <version>1.6.5</version> -->
+<!-- <scope>system</scope> -->
+<!-- <optional>true</optional> -->
+<!-- <systemPath>${java.home}/../lib/tools.jar</systemPath> -->
+<!-- </dependency> -->
+<!-- </dependencies> -->
+<!-- </plugin> -->
+<!-- </plugins> -->
+<!-- </build> -->
+<!-- </profile> -->
+<!-- </profiles> -->
+
+</project>
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BaseDataStreamMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BaseDataStreamMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BaseDataStreamMarshaller.java
new file mode 100644
index 0000000..6566f8f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BaseDataStreamMarshaller.java
@@ -0,0 +1,618 @@
+/**
+ * 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.Constructor;
+
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.fusesource.hawtbuf.Buffer;
+
+/**
+ * Root of all OpenWire marshalers.
+ */
+public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
+
+ public static final Constructor<StackTraceElement> STACK_TRACE_ELEMENT_CONSTRUCTOR;
+
+ static {
+ Constructor<StackTraceElement> constructor = null;
+ try {
+ constructor = StackTraceElement.class.getConstructor(
+ new Class[] { String.class, String.class, String.class, int.class });
+ } catch (Throwable e) {
+ }
+ STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor;
+ }
+
+ @Override
+ public abstract byte getDataStructureType();
+
+ @Override
+ public abstract DataStructure createObject();
+
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ return 0;
+ }
+
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ }
+
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ }
+
+ public int tightMarshalLong1(OpenWireFormat wireFormat, long o, BooleanStream bs) throws IOException {
+ if (o == 0) {
+ bs.writeBoolean(false);
+ bs.writeBoolean(false);
+ return 0;
+ } else if ((o & 0xFFFFFFFFFFFF0000L) == 0) {
+ bs.writeBoolean(false);
+ bs.writeBoolean(true);
+ return 2;
+ } else if ((o & 0xFFFFFFFF00000000L) == 0) {
+ bs.writeBoolean(true);
+ bs.writeBoolean(false);
+ return 4;
+ } else {
+ bs.writeBoolean(true);
+ bs.writeBoolean(true);
+ return 8;
+ }
+ }
+
+ public void tightMarshalLong2(OpenWireFormat wireFormat, long o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ if (bs.readBoolean()) {
+ dataOut.writeLong(o);
+ } else {
+ dataOut.writeInt((int) o);
+ }
+ } else {
+ if (bs.readBoolean()) {
+ dataOut.writeShort((int) o);
+ }
+ }
+ }
+
+ public long tightUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ if (bs.readBoolean()) {
+ return dataIn.readLong();
+ } else {
+ return toLong(dataIn.readInt());
+ }
+ } else {
+ if (bs.readBoolean()) {
+ return toLong(dataIn.readShort());
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ protected long toLong(short value) {
+ // lets handle negative values
+ long answer = value;
+ return answer & 0xffffL;
+ }
+
+ protected long toLong(int value) {
+ // lets handle negative values
+ long answer = value;
+ return answer & 0xffffffffL;
+ }
+
+ protected DataStructure tightUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+ return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
+ }
+
+ protected int tightMarshalNestedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) throws IOException {
+ return wireFormat.tightMarshalNestedObject1(o, bs);
+ }
+
+ protected void tightMarshalNestedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
+ }
+
+ protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ if (bs.readBoolean()) {
+ short index = dataIn.readShort();
+ DataStructure object = wireFormat.tightUnmarshalNestedObject(dataIn, bs);
+ wireFormat.setInUnmarshallCache(index, object);
+ return object;
+ } else {
+ short index = dataIn.readShort();
+ return wireFormat.getFromUnmarshallCache(index);
+ }
+ } else {
+ return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
+ }
+ }
+
+ protected int tightMarshalCachedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ Short index = wireFormat.getMarshallCacheIndex(o);
+ bs.writeBoolean(index == null);
+ if (index == null) {
+ int rc = wireFormat.tightMarshalNestedObject1(o, bs);
+ wireFormat.addToMarshallCache(o);
+ return 2 + rc;
+ } else {
+ return 2;
+ }
+ } else {
+ return wireFormat.tightMarshalNestedObject1(o, bs);
+ }
+ }
+
+ protected void tightMarshalCachedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ Short index = wireFormat.getMarshallCacheIndex(o);
+ if (bs.readBoolean()) {
+ dataOut.writeShort(index.shortValue());
+ wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
+ } else {
+ dataOut.writeShort(index.shortValue());
+ }
+ } else {
+ wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
+ }
+ }
+
+ protected Throwable tightUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ String clazz = tightUnmarshalString(dataIn, bs);
+ String message = tightUnmarshalString(dataIn, bs);
+ Throwable o = createThrowable(clazz, message);
+ if (wireFormat.isStackTraceEnabled()) {
+ if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
+ StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
+ for (int i = 0; i < ss.length; i++) {
+ try {
+ ss[i] = STACK_TRACE_ELEMENT_CONSTRUCTOR.newInstance(new Object[] { tightUnmarshalString(dataIn, bs),
+ tightUnmarshalString(dataIn, bs), tightUnmarshalString(dataIn, bs), Integer.valueOf(dataIn.readInt()) });
+ } catch (IOException e) {
+ throw e;
+ } catch (Throwable e) {
+ }
+ }
+ o.setStackTrace(ss);
+ } else {
+ short size = dataIn.readShort();
+ for (int i = 0; i < size; i++) {
+ tightUnmarshalString(dataIn, bs);
+ tightUnmarshalString(dataIn, bs);
+ tightUnmarshalString(dataIn, bs);
+ dataIn.readInt();
+ }
+ }
+ o.initCause(tightUnmarsalThrowable(wireFormat, dataIn, bs));
+
+ }
+ return o;
+ } else {
+ return null;
+ }
+ }
+
+ private Throwable createThrowable(String className, String message) {
+ try {
+ Class<?> clazz = Class.forName(className, false, BaseDataStreamMarshaller.class.getClassLoader());
+ Constructor<?> constructor = clazz.getConstructor(new Class[] { String.class });
+ return (Throwable) constructor.newInstance(new Object[] { message });
+ } catch (Throwable e) {
+ return new Throwable(className + ": " + message);
+ }
+ }
+
+ protected int tightMarshalThrowable1(OpenWireFormat wireFormat, Throwable o, BooleanStream bs) throws IOException {
+ if (o == null) {
+ bs.writeBoolean(false);
+ return 0;
+ } else {
+ int rc = 0;
+ bs.writeBoolean(true);
+ rc += tightMarshalString1(o.getClass().getName(), bs);
+ rc += tightMarshalString1(o.getMessage(), bs);
+ if (wireFormat.isStackTraceEnabled()) {
+ rc += 2;
+ StackTraceElement[] stackTrace = o.getStackTrace();
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ rc += tightMarshalString1(element.getClassName(), bs);
+ rc += tightMarshalString1(element.getMethodName(), bs);
+ rc += tightMarshalString1(element.getFileName(), bs);
+ rc += 4;
+ }
+ rc += tightMarshalThrowable1(wireFormat, o.getCause(), bs);
+ }
+ return rc;
+ }
+ }
+
+ protected void tightMarshalThrowable2(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ tightMarshalString2(o.getClass().getName(), dataOut, bs);
+ tightMarshalString2(o.getMessage(), dataOut, bs);
+ if (wireFormat.isStackTraceEnabled()) {
+ StackTraceElement[] stackTrace = o.getStackTrace();
+ dataOut.writeShort(stackTrace.length);
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ tightMarshalString2(element.getClassName(), dataOut, bs);
+ tightMarshalString2(element.getMethodName(), dataOut, bs);
+ tightMarshalString2(element.getFileName(), dataOut, bs);
+ dataOut.writeInt(element.getLineNumber());
+ }
+ tightMarshalThrowable2(wireFormat, o.getCause(), dataOut, bs);
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ if (bs.readBoolean()) {
+ int size = dataIn.readShort();
+ byte data[] = new byte[size];
+ dataIn.readFully(data);
+ // Yes deprecated, but we know what we are doing.
+ // This allows us to create a String from a ASCII byte array. (no UTF-8
+ // decoding)
+ return new String(data, 0);
+ } else {
+ return dataIn.readUTF();
+ }
+ } else {
+ return null;
+ }
+ }
+
+ protected int tightMarshalString1(String value, BooleanStream bs) throws IOException {
+ bs.writeBoolean(value != null);
+ if (value != null) {
+
+ int strlen = value.length();
+ int utflen = 0;
+ char[] charr = new char[strlen];
+ int c = 0;
+ boolean isOnlyAscii = true;
+
+ value.getChars(0, strlen, charr, 0);
+
+ for (int i = 0; i < strlen; i++) {
+ c = charr[i];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ utflen++;
+ } else if (c > 0x07FF) {
+ utflen += 3;
+ isOnlyAscii = false;
+ } else {
+ isOnlyAscii = false;
+ utflen += 2;
+ }
+ }
+
+ if (utflen >= Short.MAX_VALUE) {
+ throw new IOException("Encountered a String value that is too long to encode.");
+ }
+ bs.writeBoolean(isOnlyAscii);
+ return utflen + 2;
+
+ } else {
+ return 0;
+ }
+ }
+
+ protected void tightMarshalString2(String value, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ // If we verified it only holds ascii values
+ if (bs.readBoolean()) {
+ dataOut.writeShort(value.length());
+ dataOut.writeBytes(value);
+ } else {
+ dataOut.writeUTF(value);
+ }
+ }
+ }
+
+ protected int tightMarshalObjectArray1(OpenWireFormat wireFormat, DataStructure[] objects, BooleanStream bs) throws IOException {
+ if (objects != null) {
+ int rc = 0;
+ bs.writeBoolean(true);
+ rc += 2;
+ for (int i = 0; i < objects.length; i++) {
+ rc += tightMarshalNestedObject1(wireFormat, objects[i], bs);
+ }
+ return rc;
+ } else {
+ bs.writeBoolean(false);
+ return 0;
+ }
+ }
+
+ protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ dataOut.writeShort(objects.length);
+ for (int i = 0; i < objects.length; i++) {
+ tightMarshalNestedObject2(wireFormat, objects[i], dataOut, bs);
+ }
+ }
+ }
+
+ protected int tightMarshalConstByteArray1(byte[] data, BooleanStream bs, int i) throws IOException {
+ return i;
+ }
+
+ protected void tightMarshalConstByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs, int i) throws IOException {
+ dataOut.write(data, 0, i);
+ }
+
+ protected byte[] tightUnmarshalConstByteArray(DataInput dataIn, BooleanStream bs, int i) throws IOException {
+ byte data[] = new byte[i];
+ dataIn.readFully(data);
+ return data;
+ }
+
+ protected int tightMarshalByteArray1(byte[] data, BooleanStream bs) throws IOException {
+ bs.writeBoolean(data != null);
+ if (data != null) {
+ return data.length + 4;
+ } else {
+ return 0;
+ }
+ }
+
+ protected void tightMarshalByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ dataOut.writeInt(data.length);
+ dataOut.write(data);
+ }
+ }
+
+ protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ byte rc[] = null;
+ if (bs.readBoolean()) {
+ int size = dataIn.readInt();
+ rc = new byte[size];
+ dataIn.readFully(rc);
+ }
+ return rc;
+ }
+
+ protected int tightMarshalByteSequence1(Buffer data, BooleanStream bs) throws IOException {
+ bs.writeBoolean(data != null);
+ if (data != null) {
+ return data.getLength() + 4;
+ } else {
+ return 0;
+ }
+ }
+
+ protected void tightMarshalByteSequence2(Buffer data, DataOutput dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ dataOut.writeInt(data.getLength());
+ dataOut.write(data.getData(), data.getOffset(), data.getLength());
+ }
+ }
+
+ protected Buffer tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ Buffer rc = null;
+ if (bs.readBoolean()) {
+ int size = dataIn.readInt();
+ byte[] t = new byte[size];
+ dataIn.readFully(t);
+ return new Buffer(t, 0, size);
+ }
+ return rc;
+ }
+
+ //
+ // The loose marshaling logic
+ //
+
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ }
+
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ }
+
+ public void looseMarshalLong(OpenWireFormat wireFormat, long o, DataOutput dataOut) throws IOException {
+ dataOut.writeLong(o);
+ }
+
+ public long looseUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+ return dataIn.readLong();
+ }
+
+ protected DataStructure looseUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+ return wireFormat.looseUnmarshalNestedObject(dataIn);
+ }
+
+ protected void looseMarshalNestedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) throws IOException {
+ wireFormat.looseMarshalNestedObject(o, dataOut);
+ }
+
+ protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ if (dataIn.readBoolean()) {
+ short index = dataIn.readShort();
+ DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn);
+ wireFormat.setInUnmarshallCache(index, object);
+ return object;
+ } else {
+ short index = dataIn.readShort();
+ return wireFormat.getFromUnmarshallCache(index);
+ }
+ } else {
+ return wireFormat.looseUnmarshalNestedObject(dataIn);
+ }
+ }
+
+ protected void looseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ Short index = wireFormat.getMarshallCacheIndex(o);
+ dataOut.writeBoolean(index == null);
+ if (index == null) {
+ index = wireFormat.addToMarshallCache(o);
+ dataOut.writeShort(index.shortValue());
+ wireFormat.looseMarshalNestedObject(o, dataOut);
+ } else {
+ dataOut.writeShort(index.shortValue());
+ }
+ } else {
+ wireFormat.looseMarshalNestedObject(o, dataOut);
+ }
+ }
+
+ protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+ if (dataIn.readBoolean()) {
+ String clazz = looseUnmarshalString(dataIn);
+ String message = looseUnmarshalString(dataIn);
+ Throwable o = createThrowable(clazz, message);
+ if (wireFormat.isStackTraceEnabled()) {
+ if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
+ StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
+ for (int i = 0; i < ss.length; i++) {
+ try {
+ ss[i] = STACK_TRACE_ELEMENT_CONSTRUCTOR.newInstance(new Object[] { looseUnmarshalString(dataIn),
+ looseUnmarshalString(dataIn), looseUnmarshalString(dataIn), Integer.valueOf(dataIn.readInt()) });
+ } catch (IOException e) {
+ throw e;
+ } catch (Throwable e) {
+ }
+ }
+ o.setStackTrace(ss);
+ } else {
+ short size = dataIn.readShort();
+ for (int i = 0; i < size; i++) {
+ looseUnmarshalString(dataIn);
+ looseUnmarshalString(dataIn);
+ looseUnmarshalString(dataIn);
+ dataIn.readInt();
+ }
+ }
+ o.initCause(looseUnmarsalThrowable(wireFormat, dataIn));
+
+ }
+ return o;
+ } else {
+ return null;
+ }
+ }
+
+ protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut) throws IOException {
+ dataOut.writeBoolean(o != null);
+ if (o != null) {
+ looseMarshalString(o.getClass().getName(), dataOut);
+ looseMarshalString(o.getMessage(), dataOut);
+ if (wireFormat.isStackTraceEnabled()) {
+ StackTraceElement[] stackTrace = o.getStackTrace();
+ dataOut.writeShort(stackTrace.length);
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ looseMarshalString(element.getClassName(), dataOut);
+ looseMarshalString(element.getMethodName(), dataOut);
+ looseMarshalString(element.getFileName(), dataOut);
+ dataOut.writeInt(element.getLineNumber());
+ }
+ looseMarshalThrowable(wireFormat, o.getCause(), dataOut);
+ }
+ }
+ }
+
+ protected String looseUnmarshalString(DataInput dataIn) throws IOException {
+ if (dataIn.readBoolean()) {
+ return dataIn.readUTF();
+ } else {
+ return null;
+ }
+ }
+
+ protected void looseMarshalString(String value, DataOutput dataOut) throws IOException {
+ dataOut.writeBoolean(value != null);
+ if (value != null) {
+ dataOut.writeUTF(value);
+ }
+ }
+
+ protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects, DataOutput dataOut) throws IOException {
+ dataOut.writeBoolean(objects != null);
+ if (objects != null) {
+ dataOut.writeShort(objects.length);
+ for (int i = 0; i < objects.length; i++) {
+ looseMarshalNestedObject(wireFormat, objects[i], dataOut);
+ }
+ }
+ }
+
+ protected void looseMarshalConstByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut, int i) throws IOException {
+ dataOut.write(data, 0, i);
+ }
+
+ protected byte[] looseUnmarshalConstByteArray(DataInput dataIn, int i) throws IOException {
+ byte data[] = new byte[i];
+ dataIn.readFully(data);
+ return data;
+ }
+
+ protected void looseMarshalByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut) throws IOException {
+ dataOut.writeBoolean(data != null);
+ if (data != null) {
+ dataOut.writeInt(data.length);
+ dataOut.write(data);
+ }
+ }
+
+ protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ byte rc[] = null;
+ if (dataIn.readBoolean()) {
+ int size = dataIn.readInt();
+ rc = new byte[size];
+ dataIn.readFully(rc);
+ }
+ return rc;
+ }
+
+ protected void looseMarshalByteSequence(OpenWireFormat wireFormat, Buffer data, DataOutput dataOut) throws IOException {
+ dataOut.writeBoolean(data != null);
+ if (data != null) {
+ dataOut.writeInt(data.getLength());
+ dataOut.write(data.getData(), data.getOffset(), data.getLength());
+ }
+ }
+
+ protected Buffer looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ Buffer rc = null;
+ if (dataIn.readBoolean()) {
+ int size = dataIn.readInt();
+ byte[] t = new byte[size];
+ dataIn.readFully(t);
+ rc = new Buffer(t, 0, size);
+ }
+ return rc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BooleanStream.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BooleanStream.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BooleanStream.java
new file mode 100644
index 0000000..615b379
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/BooleanStream.java
@@ -0,0 +1,120 @@
+/**
+ * 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.nio.ByteBuffer;
+
+public final class BooleanStream {
+
+ byte data[] = new byte[48];
+ short arrayLimit;
+ short arrayPos;
+ byte bytePos;
+
+ public boolean readBoolean() throws IOException {
+ assert arrayPos <= arrayLimit;
+ byte b = data[arrayPos];
+ boolean rc = ((b >> bytePos) & 0x01) != 0;
+ bytePos++;
+ if (bytePos >= 8) {
+ bytePos = 0;
+ arrayPos++;
+ }
+ return rc;
+ }
+
+ public void writeBoolean(boolean value) throws IOException {
+ if (bytePos == 0) {
+ arrayLimit++;
+ if (arrayLimit >= data.length) {
+ // re-grow the array.
+ byte d[] = new byte[data.length * 2];
+ System.arraycopy(data, 0, d, 0, data.length);
+ data = d;
+ }
+ }
+ if (value) {
+ data[arrayPos] |= 0x01 << bytePos;
+ }
+ bytePos++;
+ if (bytePos >= 8) {
+ bytePos = 0;
+ arrayPos++;
+ }
+ }
+
+ public void marshal(DataOutput dataOut) throws IOException {
+ if (arrayLimit < 64) {
+ dataOut.writeByte(arrayLimit);
+ } else if (arrayLimit < 256) { // max value of unsigned byte
+ dataOut.writeByte(0xC0);
+ dataOut.writeByte(arrayLimit);
+ } else {
+ dataOut.writeByte(0x80);
+ dataOut.writeShort(arrayLimit);
+ }
+
+ dataOut.write(data, 0, arrayLimit);
+ clear();
+ }
+
+ public void marshal(ByteBuffer dataOut) {
+ if (arrayLimit < 64) {
+ dataOut.put((byte) arrayLimit);
+ } else if (arrayLimit < 256) { // max value of unsigned byte
+ dataOut.put((byte) 0xC0);
+ dataOut.put((byte) arrayLimit);
+ } else {
+ dataOut.put((byte) 0x80);
+ dataOut.putShort(arrayLimit);
+ }
+
+ dataOut.put(data, 0, arrayLimit);
+ }
+
+ public void unmarshal(DataInput dataIn) throws IOException {
+ arrayLimit = (short) (dataIn.readByte() & 0xFF);
+ if (arrayLimit == 0xC0) {
+ arrayLimit = (short) (dataIn.readByte() & 0xFF);
+ } else if (arrayLimit == 0x80) {
+ arrayLimit = dataIn.readShort();
+ }
+ if (data.length < arrayLimit) {
+ data = new byte[arrayLimit];
+ }
+ dataIn.readFully(data, 0, arrayLimit);
+ clear();
+ }
+
+ public void clear() {
+ arrayPos = 0;
+ bytePos = 0;
+ }
+
+ public int marshalledSize() {
+ if (arrayLimit < 64) {
+ return 1 + arrayLimit;
+ } else if (arrayLimit < 256) {
+ return 2 + arrayLimit;
+ } else {
+ return 3 + arrayLimit;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/DataStreamMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/DataStreamMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/DataStreamMarshaller.java
new file mode 100644
index 0000000..3035644
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/DataStreamMarshaller.java
@@ -0,0 +1,41 @@
+/**
+ * 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 org.apache.activemq.openwire.commands.DataStructure;
+
+public interface DataStreamMarshaller {
+
+ byte getDataStructureType();
+
+ DataStructure createObject();
+
+ int tightMarshal1(OpenWireFormat format, Object c, BooleanStream bs) throws IOException;
+
+ void tightMarshal2(OpenWireFormat format, Object c, DataOutput ds, BooleanStream bs) throws IOException;
+
+ void tightUnmarshal(OpenWireFormat format, Object data, DataInput dis, BooleanStream bs) throws IOException;
+
+ void looseMarshal(OpenWireFormat format, Object c, DataOutput ds) throws IOException;
+
+ void looseUnmarshal(OpenWireFormat format, Object data, DataInput dis) throws IOException;
+
+}
[38/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BaseCommand.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BaseCommand.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BaseCommand.java
new file mode 100644
index 0000000..2585685
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BaseCommand.java
@@ -0,0 +1,132 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller
+ */
+public abstract class BaseCommand implements Command {
+
+ protected int commandId;
+ protected boolean responseRequired;
+
+ public void copy(BaseCommand copy) {
+ copy.commandId = commandId;
+ copy.responseRequired = responseRequired;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ @Override
+ public int getCommandId() {
+ return commandId;
+ }
+
+ @Override
+ public void setCommandId(int commandId) {
+ this.commandId = commandId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ @Override
+ public boolean isResponseRequired() {
+ return responseRequired;
+ }
+
+ @Override
+ public void setResponseRequired(boolean responseRequired) {
+ this.responseRequired = responseRequired;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName();
+ }
+
+ @Override
+ public boolean isWireFormatInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isBrokerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isResponse() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatch() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessage() {
+ return false;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageAck() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatchNotification() {
+ return false;
+ }
+
+ @Override
+ public boolean isShutdownInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectionControl() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectionInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isSessionInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isProducerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isConsumerInfo() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerId.java
new file mode 100644
index 0000000..2cadf37
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerId.java
@@ -0,0 +1,76 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="124"
+ */
+public class BrokerId implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.BROKER_ID;
+ protected String value;
+
+ public BrokerId() {
+ }
+
+ public BrokerId(String brokerId) {
+ this.value = brokerId;
+ }
+
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != BrokerId.class) {
+ return false;
+ }
+ BrokerId id = (BrokerId)o;
+ return value.equals(id.value);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String brokerId) {
+ this.value = brokerId;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerInfo.java
new file mode 100644
index 0000000..49085fa
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/BrokerInfo.java
@@ -0,0 +1,236 @@
+/**
+ * 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.commands;
+
+/**
+ * When a client connects to a broker, the broker send the client a BrokerInfo
+ * so that the client knows which broker node he's talking to and also any peers
+ * that the node has in his cluster. This is the broker helping the client out
+ * in discovering other nodes in the cluster.
+ *
+ * @openwire:marshaller code="2"
+ */
+public class BrokerInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.BROKER_INFO;
+
+ protected BrokerId brokerId;
+ protected String brokerURL;
+ protected boolean slaveBroker;
+ protected boolean masterBroker;
+ protected boolean faultTolerantConfiguration;
+ protected boolean networkConnection;
+ protected boolean duplexConnection;
+ protected BrokerInfo peerBrokerInfos[];
+ protected String brokerName;
+ protected long connectionId;
+ protected String brokerUploadUrl;
+ protected String networkProperties;
+
+ public BrokerInfo copy() {
+ BrokerInfo copy = new BrokerInfo();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(BrokerInfo copy) {
+ super.copy(copy);
+ copy.brokerId = this.brokerId;
+ copy.brokerURL = this.brokerURL;
+ copy.slaveBroker = this.slaveBroker;
+ copy.masterBroker = this.masterBroker;
+ copy.faultTolerantConfiguration = this.faultTolerantConfiguration;
+ copy.networkConnection = this.networkConnection;
+ copy.duplexConnection = this.duplexConnection;
+ copy.peerBrokerInfos = this.peerBrokerInfos;
+ copy.brokerName = this.brokerName;
+ copy.connectionId = this.connectionId;
+ copy.brokerUploadUrl = this.brokerUploadUrl;
+ copy.networkProperties = this.networkProperties;
+ }
+
+ @Override
+ public boolean isBrokerInfo() {
+ return true;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId getBrokerId() {
+ return brokerId;
+ }
+
+ public void setBrokerId(BrokerId brokerId) {
+ this.brokerId = brokerId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getBrokerURL() {
+ return brokerURL;
+ }
+
+ public void setBrokerURL(String brokerURL) {
+ this.brokerURL = brokerURL;
+ }
+
+ /**
+ * @openwire:property version=1 testSize=0
+ */
+ public BrokerInfo[] getPeerBrokerInfos() {
+ return peerBrokerInfos;
+ }
+
+ public void setPeerBrokerInfos(BrokerInfo[] peerBrokerInfos) {
+ this.peerBrokerInfos = peerBrokerInfos;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getBrokerName() {
+ return brokerName;
+ }
+
+ public void setBrokerName(String brokerName) {
+ this.brokerName = brokerName;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processBrokerInfo(this);
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean isSlaveBroker() {
+ return slaveBroker;
+ }
+
+ public void setSlaveBroker(boolean slaveBroker) {
+ this.slaveBroker = slaveBroker;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean isMasterBroker() {
+ return masterBroker;
+ }
+
+ /**
+ * @param masterBroker The masterBroker to set.
+ */
+ public void setMasterBroker(boolean masterBroker) {
+ this.masterBroker = masterBroker;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the faultTolerantConfiguration.
+ */
+ public boolean isFaultTolerantConfiguration() {
+ return faultTolerantConfiguration;
+ }
+
+ /**
+ * @param faultTolerantConfiguration The faultTolerantConfiguration to set.
+ */
+ public void setFaultTolerantConfiguration(boolean faultTolerantConfiguration) {
+ this.faultTolerantConfiguration = faultTolerantConfiguration;
+ }
+
+ /**
+ * @openwire:property version=2
+ * @return the duplexConnection
+ */
+ public boolean isDuplexConnection() {
+ return this.duplexConnection;
+ }
+
+ /**
+ * @param duplexConnection the duplexConnection to set
+ */
+ public void setDuplexConnection(boolean duplexConnection) {
+ this.duplexConnection = duplexConnection;
+ }
+
+ /**
+ * @openwire:property version=2
+ * @return the networkConnection
+ */
+ public boolean isNetworkConnection() {
+ return this.networkConnection;
+ }
+
+ /**
+ * @param networkConnection the networkConnection to set
+ */
+ public void setNetworkConnection(boolean networkConnection) {
+ this.networkConnection = networkConnection;
+ }
+
+ /**
+ * The broker assigns a each connection it accepts a connection id.
+ *
+ * @openwire:property version=2
+ */
+ public long getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(long connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * The URL to use when uploading BLOBs to the broker or some other external
+ * file/http server
+ *
+ * @openwire:property version=3
+ */
+ public String getBrokerUploadUrl() {
+ return brokerUploadUrl;
+ }
+
+ public void setBrokerUploadUrl(String brokerUploadUrl) {
+ this.brokerUploadUrl = brokerUploadUrl;
+ }
+
+ /**
+ * @openwire:property version=3 cache=false
+ * @return the networkProperties
+ */
+ public String getNetworkProperties() {
+ return this.networkProperties;
+ }
+
+ /**
+ * @param networkProperties the networkProperties to set
+ */
+ public void setNetworkProperties(String networkProperties) {
+ this.networkProperties = networkProperties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Command.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Command.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Command.java
new file mode 100644
index 0000000..9023846
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Command.java
@@ -0,0 +1,64 @@
+/**
+ * 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.commands;
+
+/**
+ * The Command Pattern so that we can send and receive commands on the different
+ * transports.
+ */
+public interface Command extends DataStructure {
+
+ void setCommandId(int value);
+
+ /**
+ * @return the unique ID of this request used to map responses to requests
+ */
+ int getCommandId();
+
+ void setResponseRequired(boolean responseRequired);
+
+ boolean isResponseRequired();
+
+ boolean isResponse();
+
+ boolean isMessageDispatch();
+
+ boolean isBrokerInfo();
+
+ boolean isWireFormatInfo();
+
+ boolean isMessage();
+
+ boolean isMessageAck();
+
+ boolean isMessageDispatchNotification();
+
+ boolean isShutdownInfo();
+
+ boolean isConnectionControl();
+
+ boolean isConnectionInfo();
+
+ boolean isSessionInfo();
+
+ boolean isProducerInfo();
+
+ boolean isConsumerInfo();
+
+ Response visit(CommandVisitor visitor) throws Exception;
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandTypes.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandTypes.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandTypes.java
new file mode 100644
index 0000000..b522c81
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandTypes.java
@@ -0,0 +1,142 @@
+/**
+ * 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.commands;
+
+/**
+ * Holds the command id constants used by the command objects.
+ */
+public interface CommandTypes {
+
+ // What is the latest version of the openwire protocol
+ byte PROTOCOL_VERSION = 10;
+
+ // What is the latest version of the message store
+ byte PROTOCOL_STORE_VERSION = 6;
+
+ // A marshaling layer can use this type to specify a null object.
+ byte NULL = 0;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Info objects sent back and forth client/server when setting up a
+ // client connection, session, producer, consumer, transaction, etc...
+ ////////////////////////////////////////////////////////////////////////////
+ byte WIREFORMAT_INFO = 1;
+ byte BROKER_INFO = 2;
+ byte CONNECTION_INFO = 3;
+ byte SESSION_INFO = 4;
+ byte CONSUMER_INFO = 5;
+ byte PRODUCER_INFO = 6;
+ byte TRANSACTION_INFO = 7;
+ byte DESTINATION_INFO = 8;
+ byte REMOVE_SUBSCRIPTION_INFO = 9;
+ byte KEEP_ALIVE_INFO = 10;
+ byte SHUTDOWN_INFO = 11;
+ byte REMOVE_INFO = 12;
+ byte CONTROL_COMMAND = 14;
+ byte FLUSH_COMMAND = 15;
+ byte CONNECTION_ERROR = 16;
+ byte CONSUMER_CONTROL = 17;
+ byte CONNECTION_CONTROL = 18;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Messages that go back and forth between the client and the server.
+ ////////////////////////////////////////////////////////////////////////////
+ byte PRODUCER_ACK = 19;
+ byte MESSAGE_PULL = 20;
+ byte MESSAGE_DISPATCH = 21;
+ byte MESSAGE_ACK = 22;
+
+ byte OPENWIRE_MESSAGE = 23;
+ byte OPENWIRE_BYTES_MESSAGE = 24;
+ byte OPENWIRE_MAP_MESSAGE = 25;
+ byte OPENWIRE_OBJECT_MESSAGE = 26;
+ byte OPENWIRE_STREAM_MESSAGE = 27;
+ byte OPENWIRE_TEXT_MESSAGE = 28;
+ byte OPENWIRE_BLOB_MESSAGE = 29;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Command Response messages
+ ////////////////////////////////////////////////////////////////////////////
+ byte RESPONSE = 30;
+ byte EXCEPTION_RESPONSE = 31;
+ byte DATA_RESPONSE = 32;
+ byte DATA_ARRAY_RESPONSE = 33;
+ byte INTEGER_RESPONSE = 34;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Used by discovery
+ ////////////////////////////////////////////////////////////////////////////
+ byte DISCOVERY_EVENT = 40;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Command object used by the Journal
+ ////////////////////////////////////////////////////////////////////////////
+ byte JOURNAL_ACK = 50;
+ byte JOURNAL_REMOVE = 52;
+ byte JOURNAL_TRACE = 53;
+ byte JOURNAL_TRANSACTION = 54;
+ byte DURABLE_SUBSCRIPTION_INFO = 55;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Reliability and fragmentation
+ ////////////////////////////////////////////////////////////////////////////
+ byte PARTIAL_COMMAND = 60;
+ byte PARTIAL_LAST_COMMAND = 61;
+
+ byte REPLAY = 65;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Types used represent basic Java types.
+ ////////////////////////////////////////////////////////////////////////////
+
+ byte BYTE_TYPE = 70;
+ byte CHAR_TYPE = 71;
+ byte SHORT_TYPE = 72;
+ byte INTEGER_TYPE = 73;
+ byte LONG_TYPE = 74;
+ byte DOUBLE_TYPE = 75;
+ byte FLOAT_TYPE = 76;
+ byte STRING_TYPE = 77;
+ byte BOOLEAN_TYPE = 78;
+ byte BYTE_ARRAY_TYPE = 79;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Broker to Broker command objects
+ ////////////////////////////////////////////////////////////////////////////
+
+ byte MESSAGE_DISPATCH_NOTIFICATION = 90;
+ byte NETWORK_BRIDGE_FILTER = 91;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Data structures contained in the command objects.
+ ////////////////////////////////////////////////////////////////////////////
+
+ byte OPENWIRE_QUEUE = 100;
+ byte OPENWIRE_TOPIC = 101;
+ byte OPENWIRE_TEMP_QUEUE = 102;
+ byte OPENWIRE_TEMP_TOPIC = 103;
+
+ byte MESSAGE_ID = 110;
+ byte OPENWIRE_LOCAL_TRANSACTION_ID = 111;
+ byte OPENWIRE_XA_TRANSACTION_ID = 112;
+
+ byte CONNECTION_ID = 120;
+ byte SESSION_ID = 121;
+ byte CONSUMER_ID = 122;
+ byte PRODUCER_ID = 123;
+ byte BROKER_ID = 124;
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitor.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitor.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitor.java
new file mode 100644
index 0000000..97daccb
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitor.java
@@ -0,0 +1,89 @@
+/**
+ * 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.commands;
+
+public interface CommandVisitor {
+
+ Response processAddConnection(ConnectionInfo info) throws Exception;
+
+ Response processAddSession(SessionInfo info) throws Exception;
+
+ Response processAddProducer(ProducerInfo info) throws Exception;
+
+ Response processAddConsumer(ConsumerInfo info) throws Exception;
+
+ Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) throws Exception;
+
+ Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws Exception;
+
+ Response processRemoveProducer(ProducerId id) throws Exception;
+
+ Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws Exception;
+
+ Response processAddDestination(DestinationInfo info) throws Exception;
+
+ Response processRemoveDestination(DestinationInfo info) throws Exception;
+
+ Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception;
+
+ Response processMessage(Message send) throws Exception;
+
+ Response processMessageAck(MessageAck ack) throws Exception;
+
+ Response processMessagePull(MessagePull pull) throws Exception;
+
+ Response processBeginTransaction(TransactionInfo info) throws Exception;
+
+ Response processPrepareTransaction(TransactionInfo info) throws Exception;
+
+ Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception;
+
+ Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception;
+
+ Response processRollbackTransaction(TransactionInfo info) throws Exception;
+
+ Response processWireFormat(WireFormatInfo info) throws Exception;
+
+ Response processKeepAlive(KeepAliveInfo info) throws Exception;
+
+ Response processShutdown(ShutdownInfo info) throws Exception;
+
+ Response processFlush(FlushCommand command) throws Exception;
+
+ Response processBrokerInfo(BrokerInfo info) throws Exception;
+
+ Response processRecoverTransactions(TransactionInfo info) throws Exception;
+
+ Response processForgetTransaction(TransactionInfo info) throws Exception;
+
+ Response processEndTransaction(TransactionInfo info) throws Exception;
+
+ Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception;
+
+ Response processProducerAck(ProducerAck ack) throws Exception;
+
+ Response processMessageDispatch(MessageDispatch dispatch) throws Exception;
+
+ Response processControlCommand(ControlCommand command) throws Exception;
+
+ Response processConnectionError(ConnectionError error) throws Exception;
+
+ Response processConnectionControl(ConnectionControl control) throws Exception;
+
+ Response processConsumerControl(ConsumerControl control) throws Exception;
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitorAdapter.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitorAdapter.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitorAdapter.java
new file mode 100644
index 0000000..76ae510
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/CommandVisitorAdapter.java
@@ -0,0 +1,190 @@
+/**
+ * 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.commands;
+
+public class CommandVisitorAdapter implements CommandVisitor {
+
+ @Override
+ public Response processAddConnection(ConnectionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processAddConsumer(ConsumerInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processAddDestination(DestinationInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processAddProducer(ProducerInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processAddSession(SessionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processBeginTransaction(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processBrokerInfo(BrokerInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processEndTransaction(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processFlush(FlushCommand command) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processForgetTransaction(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processKeepAlive(KeepAliveInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processMessage(Message send) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processMessageAck(MessageAck ack) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processMessagePull(MessagePull pull) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processPrepareTransaction(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processProducerAck(ProducerAck ack) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRecoverTransactions(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRemoveDestination(DestinationInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRemoveProducer(ProducerId id) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processRollbackTransaction(TransactionInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processShutdown(ShutdownInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processWireFormat(WireFormatInfo info) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processMessageDispatch(MessageDispatch dispatch) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processControlCommand(ControlCommand command) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processConnectionControl(ConnectionControl control) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processConnectionError(ConnectionError error) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Response processConsumerControl(ConsumerControl control) throws Exception {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionControl.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionControl.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionControl.java
new file mode 100644
index 0000000..87b4cdc
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionControl.java
@@ -0,0 +1,187 @@
+/**
+ * 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.commands;
+
+/**
+ * Used by the Broker to control the connection state, the client should react to
+ * this command immediately.
+ *
+ * @openwire:marshaller code="18"
+ */
+public class ConnectionControl extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONNECTION_CONTROL;
+
+ protected boolean suspend;
+ protected boolean resume;
+ protected boolean close;
+ protected boolean exit;
+ protected boolean faultTolerant;
+ protected String connectedBrokers="";
+ protected String reconnectTo = "";
+ protected byte[] token;
+ protected boolean rebalanceConnection;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processConnectionControl(this);
+ }
+ @Override
+ public boolean isConnectionControl() {
+ return true;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the close.
+ */
+ public boolean isClose() {
+ return close;
+ }
+
+ /**
+ * @param close The close to set.
+ */
+ public void setClose(boolean close) {
+ this.close = close;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the exit.
+ */
+ public boolean isExit() {
+ return exit;
+ }
+
+ /**
+ * @param exit The exit to set.
+ */
+ public void setExit(boolean exit) {
+ this.exit = exit;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the faultTolerant.
+ */
+ public boolean isFaultTolerant() {
+ return faultTolerant;
+ }
+
+ /**
+ * @param faultTolerant The faultTolerant to set.
+ */
+ public void setFaultTolerant(boolean faultTolerant) {
+ this.faultTolerant = faultTolerant;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the resume.
+ */
+ public boolean isResume() {
+ return resume;
+ }
+
+ /**
+ * @param resume The resume to set.
+ */
+ public void setResume(boolean resume) {
+ this.resume = resume;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the suspend.
+ */
+ public boolean isSuspend() {
+ return suspend;
+ }
+
+ /**
+ * @param suspend The suspend to set.
+ */
+ public void setSuspend(boolean suspend) {
+ this.suspend = suspend;
+ }
+
+ /**
+ * @openwire:property version=6 cache=false
+ * @return connected brokers.
+ */
+ public String getConnectedBrokers() {
+ return this.connectedBrokers;
+ }
+
+ /**
+ * @param connectedBrokers the connectedBrokers to set
+ */
+ public void setConnectedBrokers(String connectedBrokers) {
+ this.connectedBrokers = connectedBrokers;
+ }
+
+ /**
+ * @openwire:property version=6 cache=false
+ * @return the reconnectTo
+ */
+ public String getReconnectTo() {
+ return this.reconnectTo;
+ }
+
+ /**
+ * @param reconnectTo the reconnectTo to set
+ */
+ public void setReconnectTo(String reconnectTo) {
+ this.reconnectTo = reconnectTo;
+ }
+
+ /**
+ * @return the rebalanceConnection
+ * @openwire:property version=6 cache=false
+ */
+ public boolean isRebalanceConnection() {
+ return this.rebalanceConnection;
+ }
+
+ /**
+ * @param rebalanceConnection the rebalanceConnection to set
+ */
+ public void setRebalanceConnection(boolean rebalanceConnection) {
+ this.rebalanceConnection = rebalanceConnection;
+ }
+
+ /**
+ * @openwire:property version=8
+ * @return the token
+ */
+ public byte[] getToken() {
+ return this.token;
+ }
+
+ /**
+ * @param token the token to set
+ */
+ public void setToken(byte[] token) {
+ this.token = token;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionError.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionError.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionError.java
new file mode 100644
index 0000000..d503e6b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionError.java
@@ -0,0 +1,60 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="16"
+ */
+public class ConnectionError extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONNECTION_ERROR;
+
+ private ConnectionId connectionId;
+ private Throwable exception;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processConnectionError(this);
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public Throwable getException() {
+ return exception;
+ }
+
+ public void setException(Throwable exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionId.java
new file mode 100644
index 0000000..5d4ef10
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionId.java
@@ -0,0 +1,98 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="120"
+ */
+public class ConnectionId implements DataStructure, Comparable<ConnectionId> {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONNECTION_ID;
+
+ protected String value;
+
+ public ConnectionId() {
+ }
+
+ public ConnectionId(String connectionId) {
+ this.value = connectionId;
+ }
+
+ public ConnectionId(ConnectionId id) {
+ this.value = id.getValue();
+ }
+
+ public ConnectionId(SessionId id) {
+ this.value = id.getConnectionId();
+ }
+
+ public ConnectionId(ProducerId id) {
+ this.value = id.getConnectionId();
+ }
+
+ public ConnectionId(ConsumerId id) {
+ this.value = id.getConnectionId();
+ }
+
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != ConnectionId.class) {
+ return false;
+ }
+ ConnectionId id = (ConnectionId)o;
+ return value.equals(id.value);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String connectionId) {
+ this.value = connectionId;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public int compareTo(ConnectionId o) {
+ return value.compareTo(o.value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionInfo.java
new file mode 100644
index 0000000..618fc43
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConnectionInfo.java
@@ -0,0 +1,228 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="3"
+ */
+public class ConnectionInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONNECTION_INFO;
+
+ protected ConnectionId connectionId;
+ protected String clientId;
+ protected String clientIp;
+ protected String userName;
+ protected String password;
+ protected BrokerId[] brokerPath;
+ protected boolean brokerMasterConnector;
+ protected boolean manageable;
+ protected boolean clientMaster = true;
+ protected boolean faultTolerant = false;
+ protected boolean failoverReconnect;
+
+ public ConnectionInfo() {
+ }
+
+ public ConnectionInfo(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ public ConnectionInfo copy() {
+ ConnectionInfo copy = new ConnectionInfo();
+ copy(copy);
+ return copy;
+ }
+
+ private void copy(ConnectionInfo copy) {
+ super.copy(copy);
+ copy.connectionId = connectionId;
+ copy.clientId = clientId;
+ copy.userName = userName;
+ copy.password = password;
+ copy.brokerPath = brokerPath;
+ copy.brokerMasterConnector = brokerMasterConnector;
+ copy.manageable = manageable;
+ copy.clientMaster = clientMaster;
+ copy.faultTolerant= faultTolerant;
+ copy.clientIp = clientIp;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public RemoveInfo createRemoveCommand() {
+ RemoveInfo command = new RemoveInfo(getConnectionId());
+ command.setResponseRequired(isResponseRequired());
+ return command;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * The route of brokers the command has moved through.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId[] getBrokerPath() {
+ return brokerPath;
+ }
+
+ public void setBrokerPath(BrokerId[] brokerPath) {
+ this.brokerPath = brokerPath;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processAddConnection(this);
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean isBrokerMasterConnector() {
+ return brokerMasterConnector;
+ }
+
+ /**
+ * @param slaveBroker The brokerMasterConnector to set.
+ */
+ public void setBrokerMasterConnector(boolean slaveBroker) {
+ this.brokerMasterConnector = slaveBroker;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public boolean isManageable() {
+ return manageable;
+ }
+
+ /**
+ * @param manageable The manageable to set.
+ */
+ public void setManageable(boolean manageable) {
+ this.manageable = manageable;
+ }
+
+ /**
+ * @openwire:property version=2
+ * @return the clientMaster
+ */
+ public boolean isClientMaster() {
+ return this.clientMaster;
+ }
+
+ /**
+ * @param clientMaster the clientMaster to set
+ */
+ public void setClientMaster(boolean clientMaster) {
+ this.clientMaster = clientMaster;
+ }
+
+ /**
+ * @openwire:property version=6 cache=false
+ * @return the faultTolerant
+ */
+ public boolean isFaultTolerant() {
+ return this.faultTolerant;
+ }
+
+ /**
+ * @param faultTolerant the faultTolerant to set
+ */
+ public void setFaultTolerant(boolean faultTolerant) {
+ this.faultTolerant = faultTolerant;
+ }
+
+ /**
+ * @openwire:property version=6 cache=false
+ * @return failoverReconnect true if this is a reconnect
+ */
+ public boolean isFailoverReconnect() {
+ return this.failoverReconnect;
+ }
+
+ public void setFailoverReconnect(boolean failoverReconnect) {
+ this.failoverReconnect = failoverReconnect;
+ }
+
+ /**
+ * @openwire:property version=8
+ */
+ public String getClientIp() {
+ return clientIp;
+ }
+
+ public void setClientIp(String clientIp) {
+ this.clientIp = clientIp;
+ }
+
+ @Override
+ public String toString() {
+ return "ConnectionInfo: { " + getConnectionId() + " }";
+ }
+
+ @Override
+ public boolean isConnectionInfo() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerControl.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerControl.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerControl.java
new file mode 100644
index 0000000..b85d224
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerControl.java
@@ -0,0 +1,147 @@
+/**
+ * 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.commands;
+
+/**
+ * Used by the Broker to control various aspects of a consumer instance.
+ *
+ * @openwire:marshaller code="17"
+ */
+public class ConsumerControl extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONSUMER_CONTROL;
+
+ protected ConsumerId consumerId;
+ protected boolean close;
+ protected boolean stop;
+ protected boolean start;
+ protected boolean flush;
+ protected int prefetch;
+ protected OpenWireDestination destination;
+
+ /**
+ * @openwire:property version=6
+ * @return Returns the destination.
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processConsumerControl(this);
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the close.
+ */
+ public boolean isClose() {
+ return close;
+ }
+
+ /**
+ * @param close The close to set.
+ */
+ public void setClose(boolean close) {
+ this.close = close;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the consumerId.
+ */
+ public ConsumerId getConsumerId() {
+ return consumerId;
+ }
+
+ /**
+ * @param consumerId The consumerId to set.
+ */
+ public void setConsumerId(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the prefetch.
+ */
+ public int getPrefetch() {
+ return prefetch;
+ }
+
+ /**
+ * @param prefetch The prefetch to set.
+ */
+ public void setPrefetch(int prefetch) {
+ this.prefetch = prefetch;
+ }
+
+ /**
+ * @openwire:property version=2
+ * @return the flush
+ */
+ public boolean isFlush() {
+ return this.flush;
+ }
+
+ /**
+ * @param flush the flush to set
+ */
+ public void setFlush(boolean flush) {
+ this.flush = flush;
+ }
+
+ /**
+ * @openwire:property version=2
+ * @return the start
+ */
+ public boolean isStart() {
+ return this.start;
+ }
+
+ /**
+ * @param start the start to set
+ */
+ public void setStart(boolean start) {
+ this.start = start;
+ }
+
+ /**
+ * @openwire:property version=2
+ * @return the stop
+ */
+ public boolean isStop() {
+ return this.stop;
+ }
+
+ /**
+ * @param stop the stop to set
+ */
+ public void setStop(boolean stop) {
+ this.stop = stop;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerId.java
new file mode 100644
index 0000000..8556f75
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerId.java
@@ -0,0 +1,137 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.commands;
+
+/**
+ * @openwire:marshaller code="122"
+ */
+public class ConsumerId implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONSUMER_ID;
+
+ protected String connectionId;
+ protected long sessionId;
+ protected long value;
+
+ protected transient int hashCode;
+ protected transient String key;
+ protected transient SessionId parentId;
+
+ public ConsumerId() {
+ }
+
+ public ConsumerId(String str){
+ if (str != null){
+ String[] splits = str.split(":");
+ if (splits != null && splits.length >= 3){
+ this.connectionId = splits[0];
+ this.sessionId = Long.parseLong(splits[1]);
+ this.value = Long.parseLong(splits[2]);
+ }
+ }
+ }
+
+ public ConsumerId(SessionId sessionId, long consumerId) {
+ this.connectionId = sessionId.getConnectionId();
+ this.sessionId = sessionId.getValue();
+ this.value = consumerId;
+ }
+
+ public ConsumerId(ConsumerId id) {
+ this.connectionId = id.getConnectionId();
+ this.sessionId = id.getSessionId();
+ this.value = id.getValue();
+ }
+
+ public SessionId getParentId() {
+ if (parentId == null) {
+ parentId = new SessionId(this);
+ }
+ return parentId;
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != ConsumerId.class) {
+ return false;
+ }
+ ConsumerId id = (ConsumerId)o;
+ return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public String toString() {
+ if (key == null) {
+ key = connectionId + ":" + sessionId + ":" + value;
+ }
+ return key;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(String connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getValue() {
+ return value;
+ }
+
+ public void setValue(long consumerId) {
+ this.value = consumerId;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerInfo.java
new file mode 100644
index 0000000..0fae7d4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ConsumerInfo.java
@@ -0,0 +1,447 @@
+/**
+ * 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.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @openwire:marshaller code="5"
+ */
+public class ConsumerInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONSUMER_INFO;
+
+ public static final byte HIGH_PRIORITY = 10;
+ public static final byte NORMAL_PRIORITY = 0;
+ public static final byte NETWORK_CONSUMER_PRIORITY = -5;
+ public static final byte LOW_PRIORITY = -10;
+
+ protected ConsumerId consumerId;
+ protected OpenWireDestination destination;
+ protected int prefetchSize;
+ protected int maximumPendingMessageLimit;
+ protected boolean browser;
+ protected boolean dispatchAsync;
+ protected String selector;
+ protected String clientId;
+ protected String subscriptionName;
+ protected boolean noLocal;
+ protected boolean exclusive;
+ protected boolean retroactive;
+ protected byte priority;
+ protected BrokerId[] brokerPath;
+ protected boolean optimizedAcknowledge;
+ protected boolean noRangeAcks;
+
+ // Network connector values should not be serialized.
+ protected transient boolean networkSubscription;
+ protected transient List<ConsumerId> networkConsumerIds;
+
+ protected Object additionalPredicate;
+
+ public ConsumerInfo() {
+ }
+
+ public ConsumerInfo(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ public ConsumerInfo(SessionInfo sessionInfo, long consumerId) {
+ this.consumerId = new ConsumerId(sessionInfo.getSessionId(), consumerId);
+ }
+
+ public ConsumerInfo copy() {
+ ConsumerInfo info = new ConsumerInfo();
+ copy(info);
+ return info;
+ }
+
+ public void copy(ConsumerInfo info) {
+ super.copy(info);
+ info.consumerId = consumerId;
+ info.destination = destination;
+ info.prefetchSize = prefetchSize;
+ info.maximumPendingMessageLimit = maximumPendingMessageLimit;
+ info.browser = browser;
+ info.dispatchAsync = dispatchAsync;
+ info.selector = selector;
+ info.clientId = clientId;
+ info.subscriptionName = subscriptionName;
+ info.noLocal = noLocal;
+ info.exclusive = exclusive;
+ info.retroactive = retroactive;
+ info.priority = priority;
+ info.brokerPath = brokerPath;
+ info.networkSubscription = networkSubscription;
+ }
+
+ public boolean isDurable() {
+ return subscriptionName != null;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * Is used to uniquely identify the consumer to the broker.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public ConsumerId getConsumerId() {
+ return consumerId;
+ }
+
+ public void setConsumerId(ConsumerId consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ /**
+ * Is this consumer a queue browser?
+ *
+ * @openwire:property version=1
+ */
+ public boolean isBrowser() {
+ return browser;
+ }
+
+ public void setBrowser(boolean browser) {
+ this.browser = browser;
+ }
+
+ /**
+ * The destination that the consumer is interested in receiving messages
+ * from. This destination could be a composite destination.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * How many messages a broker will send to the client without receiving an
+ * ack before he stops dispatching messages to the client.
+ *
+ * @openwire:property version=1
+ */
+ public int getPrefetchSize() {
+ return prefetchSize;
+ }
+
+ public void setPrefetchSize(int prefetchSize) {
+ this.prefetchSize = prefetchSize;
+ }
+
+ /**
+ * How many messages a broker will keep around, above the prefetch limit,
+ * for non-durable topics before starting to discard older messages.
+ *
+ * @openwire:property version=1
+ */
+ public int getMaximumPendingMessageLimit() {
+ return maximumPendingMessageLimit;
+ }
+
+ public void setMaximumPendingMessageLimit(int maximumPendingMessageLimit) {
+ this.maximumPendingMessageLimit = maximumPendingMessageLimit;
+ }
+
+ /**
+ * Should the broker dispatch a message to the consumer async? If he does it
+ * async, then he uses a more SEDA style of processing while if it is not
+ * done async, then he broker use a STP style of processing. STP is more
+ * appropriate in high bandwidth situations or when being used by and in vm
+ * transport.
+ *
+ * @openwire:property version=1
+ */
+ public boolean isDispatchAsync() {
+ return dispatchAsync;
+ }
+
+ public void setDispatchAsync(boolean dispatchAsync) {
+ this.dispatchAsync = dispatchAsync;
+ }
+
+ /**
+ * The JMS selector used to filter out messages that this consumer is
+ * interested in.
+ *
+ * @openwire:property version=1
+ */
+ public String getSelector() {
+ return selector;
+ }
+
+ public void setSelector(String selector) {
+ this.selector = selector;
+ }
+
+ /**
+ * Used to identify the id of a client connection.
+ *
+ * @openwire:property version=10
+ */
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ /**
+ * Used to identify the name of a durable subscription.
+ *
+ * @openwire:property version=1
+ */
+ public String getSubscriptionName() {
+ return subscriptionName;
+ }
+
+ public void setSubscriptionName(String durableSubscriptionId) {
+ this.subscriptionName = durableSubscriptionId;
+ }
+
+ /**
+ * Set noLocal to true to avoid receiving messages that were published
+ * locally on the same connection.
+ *
+ * @openwire:property version=1
+ */
+ public boolean isNoLocal() {
+ return noLocal;
+ }
+
+ public void setNoLocal(boolean noLocal) {
+ this.noLocal = noLocal;
+ }
+
+ /**
+ * An exclusive consumer locks out other consumers from being able to
+ * receive messages from the destination. If there are multiple exclusive
+ * consumers for a destination, the first one created will be the exclusive
+ * consumer of the destination.
+ *
+ * @openwire:property version=1
+ */
+ public boolean isExclusive() {
+ return exclusive;
+ }
+
+ public void setExclusive(boolean exclusive) {
+ this.exclusive = exclusive;
+ }
+
+ /**
+ * A retroactive consumer only has meaning for Topics. It allows a consumer
+ * to retroactively see messages sent prior to the consumer being created.
+ * If the consumer is not durable, it will be delivered the last message
+ * published to the topic. If the consumer is durable then it will receive
+ * all persistent messages that are still stored in persistent storage for
+ * that topic.
+ *
+ * @openwire:property version=1
+ */
+ public boolean isRetroactive() {
+ return retroactive;
+ }
+
+ public void setRetroactive(boolean retroactive) {
+ this.retroactive = retroactive;
+ }
+
+ public RemoveInfo createRemoveCommand() {
+ RemoveInfo command = new RemoveInfo(getConsumerId());
+ command.setResponseRequired(isResponseRequired());
+ return command;
+ }
+
+ /**
+ * The broker will avoid dispatching to a lower priority consumer if there
+ * are other higher priority consumers available to dispatch to. This allows
+ * letting the broker to have an affinity to higher priority consumers.
+ * Default priority is 0.
+ *
+ * @openwire:property version=1
+ */
+ public byte getPriority() {
+ return priority;
+ }
+
+ public void setPriority(byte priority) {
+ this.priority = priority;
+ }
+
+ /**
+ * The route of brokers the command has moved through.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId[] getBrokerPath() {
+ return brokerPath;
+ }
+
+ public void setBrokerPath(BrokerId[] brokerPath) {
+ this.brokerPath = brokerPath;
+ }
+
+ /**
+ * A transient additional predicate that can be used it inject additional
+ * predicates into the selector on the fly. Handy if if say a Security
+ * Broker interceptor wants to filter out messages based on security level
+ * of the consumer.
+ *
+ * @openwire:property version=1
+ */
+ public Object getAdditionalPredicate() {
+ return additionalPredicate;
+ }
+
+ public void setAdditionalPredicate(Object additionalPredicate) {
+ this.additionalPredicate = additionalPredicate;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processAddConsumer(this);
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the networkSubscription.
+ */
+ public boolean isNetworkSubscription() {
+ return networkSubscription;
+ }
+
+ /**
+ * @param networkSubscription The networkSubscription to set.
+ */
+ public void setNetworkSubscription(boolean networkSubscription) {
+ this.networkSubscription = networkSubscription;
+ }
+
+ /**
+ * @openwire:property version=1
+ * @return Returns the optimizedAcknowledge.
+ */
+ public boolean isOptimizedAcknowledge() {
+ return optimizedAcknowledge;
+ }
+
+ /**
+ * @param optimizedAcknowledge The optimizedAcknowledge to set.
+ */
+ public void setOptimizedAcknowledge(boolean optimizedAcknowledge) {
+ this.optimizedAcknowledge = optimizedAcknowledge;
+ }
+
+ /**
+ * The broker may be able to optimize it's processing or provides better QOS
+ * if it knows the consumer will not be sending ranged acks.
+ *
+ * @return true if the consumer will not send range acks.
+ * @openwire:property version=1
+ */
+ public boolean isNoRangeAcks() {
+ return noRangeAcks;
+ }
+
+ public void setNoRangeAcks(boolean noRangeAcks) {
+ this.noRangeAcks = noRangeAcks;
+ }
+
+ /**
+ * Tracks the original subscription id that causes a subscription to
+ * percolate through a network when networkTTL > 1. Tracking the original
+ * subscription allows duplicate suppression.
+ *
+ * @return array of the current subscription path
+ * @openwire:property version=4
+ */
+ public ConsumerId[] getNetworkConsumerPath() {
+ ConsumerId[] result = null;
+ if (networkConsumerIds != null) {
+ result = networkConsumerIds.toArray(new ConsumerId[0]);
+ }
+ return result;
+ }
+
+ public void setNetworkConsumerPath(ConsumerId[] consumerPath) {
+ if (consumerPath != null) {
+ for (int i=0; i<consumerPath.length; i++) {
+ addNetworkConsumerId(consumerPath[i]);
+ }
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return (consumerId == null) ? 0 : consumerId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ ConsumerInfo other = (ConsumerInfo) obj;
+
+ if (consumerId == null && other.consumerId != null) {
+ return false;
+ } else if (!consumerId.equals(other.consumerId)) {
+ return false;
+ }
+ return true;
+ }
+
+ public synchronized void addNetworkConsumerId(ConsumerId networkConsumerId) {
+ if (networkConsumerIds == null) {
+ networkConsumerIds = new ArrayList<ConsumerId>();
+ }
+ networkConsumerIds.add(networkConsumerId);
+ }
+
+ public synchronized void removeNetworkConsumerId(ConsumerId networkConsumerId) {
+ if (networkConsumerIds != null) {
+ networkConsumerIds.remove(networkConsumerId);
+ if (networkConsumerIds.isEmpty()) {
+ networkConsumerIds=null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isConsumerInfo() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ControlCommand.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ControlCommand.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ControlCommand.java
new file mode 100644
index 0000000..546e19c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ControlCommand.java
@@ -0,0 +1,50 @@
+/**
+ * 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.commands;
+
+/**
+ * Used by the Broker to send a specific named command to the client.
+ *
+ * @openwire:marshaller code="14"
+ */
+public class ControlCommand extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONTROL_COMMAND;
+
+ private String command;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processControlCommand(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataArrayResponse.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataArrayResponse.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataArrayResponse.java
new file mode 100644
index 0000000..9ae776a
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataArrayResponse.java
@@ -0,0 +1,50 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="33"
+ */
+public class DataArrayResponse extends Response {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.DATA_ARRAY_RESPONSE;
+
+ DataStructure data[];
+
+ public DataArrayResponse() {
+ }
+
+ public DataArrayResponse(DataStructure data[]) {
+ this.data = data;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public DataStructure[] getData() {
+ return data;
+ }
+
+ public void setData(DataStructure[] data) {
+ this.data = data;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataResponse.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataResponse.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataResponse.java
new file mode 100644
index 0000000..af0a16f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataResponse.java
@@ -0,0 +1,50 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="32"
+ */
+public class DataResponse extends Response {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.DATA_RESPONSE;
+
+ DataStructure data;
+
+ public DataResponse() {
+ }
+
+ public DataResponse(DataStructure data) {
+ this.data = data;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public DataStructure getData() {
+ return data;
+ }
+
+ public void setData(DataStructure data) {
+ this.data = data;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataStructure.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataStructure.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataStructure.java
new file mode 100644
index 0000000..50c43c4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DataStructure.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commands;
+
+/**
+ * Base class for all the OpenWire commands and resource objects.
+ */
+public interface DataStructure {
+
+ /**
+ * @return The type of the data structure
+ */
+ byte getDataStructureType();
+
+ /**
+ * Returns true when a Data Structure instance want to be made aware of the
+ * marshaling events associated with send and receive of the command.
+ *
+ * Any instance that is marshal aware will implement the MarshalAware interface
+ * however this method provides a shortcut that can be faster than a direct
+ * instance of check on each marshaled object.
+ *
+ * @return if the data structure is marshal aware.
+ */
+ boolean isMarshallAware();
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DestinationInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DestinationInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DestinationInfo.java
new file mode 100644
index 0000000..8251482
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DestinationInfo.java
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.commands;
+
+import java.io.IOException;
+
+/**
+ * Used to create and destroy destinations on the broker.
+ *
+ * @openwire:marshaller code="8"
+ */
+public class DestinationInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.DESTINATION_INFO;
+
+ public static final byte ADD_OPERATION_TYPE = 0;
+ public static final byte REMOVE_OPERATION_TYPE = 1;
+
+ protected ConnectionId connectionId;
+ protected OpenWireDestination destination;
+ protected byte operationType;
+ protected long timeout;
+ protected BrokerId[] brokerPath;
+
+ public DestinationInfo() {
+ }
+
+ public DestinationInfo(ConnectionId connectionId, byte operationType, OpenWireDestination destination) {
+ this.connectionId = connectionId;
+ this.operationType = operationType;
+ this.destination = destination;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ public boolean isAddOperation() {
+ return operationType == ADD_OPERATION_TYPE;
+ }
+
+ public boolean isRemoveOperation() {
+ return operationType == REMOVE_OPERATION_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public byte getOperationType() {
+ return operationType;
+ }
+
+ public void setOperationType(byte operationType) {
+ this.operationType = operationType;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ /**
+ * The route of brokers the command has moved through.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId[] getBrokerPath() {
+ return brokerPath;
+ }
+
+ public void setBrokerPath(BrokerId[] brokerPath) {
+ this.brokerPath = brokerPath;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ if (isAddOperation()) {
+ return visitor.processAddDestination(this);
+ } else if (isRemoveOperation()) {
+ return visitor.processRemoveDestination(this);
+ }
+
+ throw new IOException("Unknown operation type: " + getOperationType());
+ }
+
+ public DestinationInfo copy() {
+ DestinationInfo result = new DestinationInfo();
+ super.copy(result);
+ result.connectionId = connectionId;
+ result.destination = destination;
+ result.operationType = operationType;
+ result.brokerPath = brokerPath;
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DiscoveryEvent.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DiscoveryEvent.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DiscoveryEvent.java
new file mode 100644
index 0000000..590ed5e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/DiscoveryEvent.java
@@ -0,0 +1,74 @@
+/**
+ * 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.commands;
+
+/**
+ * Represents a discovery event containing the details of the service
+ *
+ * @openwire:marshaller code="40"
+ */
+public class DiscoveryEvent implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.DISCOVERY_EVENT;
+
+ protected String serviceName;
+ protected String brokerName;
+
+ public DiscoveryEvent() {
+ }
+
+ public DiscoveryEvent(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ protected DiscoveryEvent(DiscoveryEvent copy) {
+ serviceName = copy.serviceName;
+ brokerName = copy.brokerName;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getBrokerName() {
+ return brokerName;
+ }
+
+ public void setBrokerName(String name) {
+ this.brokerName = name;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+}
[17/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..06042e6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..dd089ec
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageIdMarshaller.java
new file mode 100644
index 0000000..6e7c080
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageMarshaller.java
new file mode 100644
index 0000000..b668178
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageMarshaller.java
@@ -0,0 +1,304 @@
+/**
+ * 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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessagePullMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessagePullMarshaller.java
new file mode 100644
index 0000000..55b13bc
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..fd88209
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v4;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBlobMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..8d2882b
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..d5fdbc4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..045933e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireDestinationMarshaller.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.v4;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..50597be
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..3d71585
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..bbafba4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..ba00d36
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireStreamMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..7e7db7c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..0505a47
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v4;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[43/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTextMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTextMessageMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTextMessageMarshaller.java
new file mode 100644
index 0000000..f03b85c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTextMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+
+public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTextMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTextMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTopicMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTopicMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTopicMarshaller.java
new file mode 100644
index 0000000..75c46f7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTopicMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireTopic.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireTopic();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/PartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/PartialCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/PartialCommandMarshaller.java
new file mode 100644
index 0000000..02378e2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/PartialCommandMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.PartialCommand;
+
+public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return PartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new PartialCommand();
+ }
+
+ /**
+ * 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ dataOut.writeInt(info.getCommandId());
+ tightMarshalByteArray2(info.getData(), 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);
+
+ PartialCommand info = (PartialCommand) o;
+ info.setCommandId(dataIn.readInt());
+ info.setData(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ PartialCommand info = (PartialCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCommandId());
+ looseMarshalByteArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerAckMarshaller.java
new file mode 100644
index 0000000..e0c3c53
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerAckMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerAck;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerAck();
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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);
+
+ ProducerAck info = (ProducerAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ dataOut.writeInt(info.getSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerAck info = (ProducerAck) o;
+ info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerAck info = (ProducerAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut);
+ dataOut.writeInt(info.getSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerIdMarshaller.java
new file mode 100644
index 0000000..29a809c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerIdMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class ProducerIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerId();
+ }
+
+ /**
+ * 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(tightUnmarshalString(dataIn, bs));
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ tightMarshalString2(info.getConnectionId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getSessionId(), 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);
+
+ ProducerId info = (ProducerId) o;
+ info.setConnectionId(looseUnmarshalString(dataIn));
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSessionId(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 {
+ ProducerId info = (ProducerId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerInfoMarshaller.java
new file mode 100644
index 0000000..63ce3c4
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+
+public class ProducerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ProducerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ProducerInfo();
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(bs.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+
+ 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getWindowSize());
+ }
+
+ /**
+ * 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);
+
+ ProducerInfo info = (ProducerInfo) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setWindowSize(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ProducerInfo info = (ProducerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ dataOut.writeBoolean(info.isDispatchAsync());
+ dataOut.writeInt(info.getWindowSize());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveInfoMarshaller.java
new file mode 100644
index 0000000..9cdae05
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveInfoMarshaller.java
@@ -0,0 +1,128 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveInfo;
+
+public class RemoveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getObjectId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getLastDeliveredSequenceId(), 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);
+
+ RemoveInfo info = (RemoveInfo) o;
+ info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setLastDeliveredSequenceId(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 {
+ RemoveInfo info = (RemoveInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut);
+ looseMarshalLong(wireFormat, info.getLastDeliveredSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveSubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveSubscriptionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveSubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..b981630
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveSubscriptionInfoMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v10;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo;
+
+public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new RemoveSubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(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 {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), 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);
+
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ReplayCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ReplayCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ReplayCommandMarshaller.java
new file mode 100644
index 0000000..5ad57cc
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ReplayCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ReplayCommand;
+
+public class ReplayCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ReplayCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ReplayCommand();
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ return rc + 8;
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+
+ /**
+ * 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);
+
+ ReplayCommand info = (ReplayCommand) o;
+ info.setFirstNakNumber(dataIn.readInt());
+ info.setLastNakNumber(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ReplayCommand info = (ReplayCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFirstNakNumber());
+ dataOut.writeInt(info.getLastNakNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ResponseMarshaller.java
new file mode 100644
index 0000000..177d3cf
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ResponseMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.Response;
+
+public class ResponseMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return Response.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new Response();
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ Response info = (Response) o;
+ dataOut.writeInt(info.getCorrelationId());
+ }
+
+ /**
+ * 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);
+
+ Response info = (Response) o;
+ info.setCorrelationId(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Response info = (Response) o;
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getCorrelationId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionIdMarshaller.java
new file mode 100644
index 0000000..cb894c0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionIdMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+
+public class SessionIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionId();
+ }
+
+ /**
+ * 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(tightUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ tightMarshalString2(info.getConnectionId(), 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);
+
+ SessionId info = (SessionId) o;
+ info.setConnectionId(looseUnmarshalString(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 {
+ SessionId info = (SessionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getConnectionId(), dataOut);
+ looseMarshalLong(wireFormat, 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/v10/SessionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionInfoMarshaller.java
new file mode 100644
index 0000000..280e560
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SessionInfoMarshaller.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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.SessionId;
+import org.apache.activemq.openwire.commands.SessionInfo;
+
+public class SessionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SessionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SessionInfo();
+ }
+
+ /**
+ * 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) tightUnmarsalCachedObject(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 {
+ SessionInfo info = (SessionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getSessionId(), 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);
+
+ SessionInfo info = (SessionInfo) o;
+ info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ SessionInfo info = (SessionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ShutdownInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ShutdownInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ShutdownInfoMarshaller.java
new file mode 100644
index 0000000..72832ad
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/ShutdownInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+
+public class ShutdownInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ShutdownInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ShutdownInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SubscriptionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SubscriptionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SubscriptionInfoMarshaller.java
new file mode 100644
index 0000000..126cfc7
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/SubscriptionInfoMarshaller.java
@@ -0,0 +1,145 @@
+/**
+ * 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.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.SubscriptionInfo;
+
+public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return SubscriptionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new SubscriptionInfo();
+ }
+
+ /**
+ * 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubcriptionName(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), 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);
+
+ SubscriptionInfo info = (SubscriptionInfo) o;
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubcriptionName(looseUnmarshalString(dataIn));
+ info.setSubscribedDestination((OpenWireDestination) 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 {
+ SubscriptionInfo info = (SubscriptionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubcriptionName(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionIdMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionIdMarshaller.java
new file mode 100644
index 0000000..f0d7327
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionIdMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v10;
+
+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;
+
+public abstract class TransactionIdMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..182e131
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionInfoMarshaller.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.v10;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..498ccc6
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v10;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
[03/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionInfoMarshaller.java
new file mode 100644
index 0000000..b8bc6f6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/TransactionInfoMarshaller.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.v7;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.TransactionId;
+import org.apache.activemq.openwire.commands.TransactionInfo;
+
+public class TransactionInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return TransactionInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new TransactionInfo();
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ }
+
+ /**
+ * 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);
+
+ TransactionInfo info = (TransactionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ TransactionInfo info = (TransactionInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoMarshaller.java
new file mode 100644
index 0000000..a05e332
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoMarshaller.java
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.codec.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+
+public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return WireFormatInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new WireFormatInfo();
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+ tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8);
+ dataOut.writeInt(info.getVersion());
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
+ info.setVersion(dataIn.readInt());
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ WireFormatInfo info = (WireFormatInfo) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8);
+ dataOut.writeInt(info.getVersion());
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/XATransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/XATransactionIdMarshaller.java
new file mode 100644
index 0000000..c36ddc9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/XATransactionIdMarshaller.java
@@ -0,0 +1,132 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.XATransactionId;
+
+public class XATransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return XATransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new XATransactionId();
+ }
+
+ /**
+ * 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs);
+ rc += tightMarshalByteArray1(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ dataOut.writeInt(info.getFormatId());
+ tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs);
+ tightMarshalByteArray2(info.getBranchQualifier(), 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);
+
+ XATransactionId info = (XATransactionId) o;
+ info.setFormatId(dataIn.readInt());
+ info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ XATransactionId info = (XATransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getFormatId());
+ looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut);
+ looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BaseCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BaseCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BaseCommandMarshaller.java
new file mode 100644
index 0000000..2eb8f23
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/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.v8;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerIdMarshaller.java
new file mode 100644
index 0000000..93ee31c
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerIdMarshaller.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.v8;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerInfoMarshaller.java
new file mode 100644
index 0000000..9882765
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/BrokerInfoMarshaller.java
@@ -0,0 +1,199 @@
+/**
+ * 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.v8;
+
+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());
+ info.setDuplexConnection(bs.readBoolean());
+ info.setNetworkConnection(bs.readBoolean());
+ info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs));
+ info.setNetworkProperties(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 {
+ 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());
+ bs.writeBoolean(info.isDuplexConnection());
+ bs.writeBoolean(info.isNetworkConnection());
+ rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalString1(info.getBrokerUploadUrl(), bs);
+ rc += tightMarshalString1(info.getNetworkProperties(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs);
+ tightMarshalString2(info.getNetworkProperties(), 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);
+
+ 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());
+ info.setDuplexConnection(dataIn.readBoolean());
+ info.setNetworkConnection(dataIn.readBoolean());
+ info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerUploadUrl(looseUnmarshalString(dataIn));
+ info.setNetworkProperties(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isDuplexConnection());
+ dataOut.writeBoolean(info.isNetworkConnection());
+ looseMarshalLong(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalString(info.getBrokerUploadUrl(), dataOut);
+ looseMarshalString(info.getNetworkProperties(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionControlMarshaller.java
new file mode 100644
index 0000000..c730c89
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionControlMarshaller.java
@@ -0,0 +1,163 @@
+/**
+ * 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.v8;
+
+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());
+ info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
+ info.setReconnectTo(tightUnmarshalString(dataIn, bs));
+ info.setRebalanceConnection(bs.readBoolean());
+ info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ }
+
+ /**
+ * 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());
+ rc += tightMarshalString1(info.getConnectedBrokers(), bs);
+ rc += tightMarshalString1(info.getReconnectTo(), bs);
+ bs.writeBoolean(info.isRebalanceConnection());
+ rc += tightMarshalByteArray1(info.getToken(), 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getConnectedBrokers(), dataOut, bs);
+ tightMarshalString2(info.getReconnectTo(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalByteArray2(info.getToken(), 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);
+
+ ConnectionControl info = (ConnectionControl) o;
+ info.setClose(dataIn.readBoolean());
+ info.setExit(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setResume(dataIn.readBoolean());
+ info.setSuspend(dataIn.readBoolean());
+ info.setConnectedBrokers(looseUnmarshalString(dataIn));
+ info.setReconnectTo(looseUnmarshalString(dataIn));
+ info.setRebalanceConnection(dataIn.readBoolean());
+ info.setToken(looseUnmarshalByteArray(dataIn));
+ }
+
+ /**
+ * 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());
+ looseMarshalString(info.getConnectedBrokers(), dataOut);
+ looseMarshalString(info.getReconnectTo(), dataOut);
+ dataOut.writeBoolean(info.isRebalanceConnection());
+ looseMarshalByteArray(wireFormat, info.getToken(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionErrorMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionErrorMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionErrorMarshaller.java
new file mode 100644
index 0000000..33f6847
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/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.v8;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionIdMarshaller.java
new file mode 100644
index 0000000..cc3114d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/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.v8;
+
+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-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionInfoMarshaller.java
new file mode 100644
index 0000000..95152a4
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConnectionInfoMarshaller.java
@@ -0,0 +1,195 @@
+/**
+ * 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.v8;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+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((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();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(bs.readBoolean());
+ info.setManageable(bs.readBoolean());
+ info.setClientMaster(bs.readBoolean());
+ info.setFaultTolerant(bs.readBoolean());
+ info.setFailoverReconnect(bs.readBoolean());
+ info.setClientIp(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 {
+ 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());
+ bs.writeBoolean(info.isClientMaster());
+ bs.writeBoolean(info.isFaultTolerant());
+ bs.writeBoolean(info.isFailoverReconnect());
+ rc += tightMarshalString1(info.getClientIp(), 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);
+
+ 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();
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalString2(info.getClientIp(), 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);
+
+ ConnectionInfo info = (ConnectionInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setPassword(looseUnmarshalString(dataIn));
+ info.setUserName(looseUnmarshalString(dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setBrokerMasterConnector(dataIn.readBoolean());
+ info.setManageable(dataIn.readBoolean());
+ info.setClientMaster(dataIn.readBoolean());
+ info.setFaultTolerant(dataIn.readBoolean());
+ info.setFailoverReconnect(dataIn.readBoolean());
+ info.setClientIp(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * 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());
+ dataOut.writeBoolean(info.isClientMaster());
+ dataOut.writeBoolean(info.isFaultTolerant());
+ dataOut.writeBoolean(info.isFailoverReconnect());
+ looseMarshalString(info.getClientIp(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerControlMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerControlMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerControlMarshaller.java
new file mode 100644
index 0000000..fb678ed
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerControlMarshaller.java
@@ -0,0 +1,154 @@
+/**
+ * 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.v8;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+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.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setClose(bs.readBoolean());
+ info.setConsumerId((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(bs.readBoolean());
+ info.setStart(bs.readBoolean());
+ info.setStop(bs.readBoolean());
+ }
+
+ /**
+ * 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);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isClose());
+ rc += tightMarshalNestedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isFlush());
+ bs.writeBoolean(info.isStart());
+ bs.writeBoolean(info.isStop());
+
+ 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;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalNestedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetch());
+ 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);
+
+ ConsumerControl info = (ConsumerControl) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setClose(dataIn.readBoolean());
+ info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setPrefetch(dataIn.readInt());
+ info.setFlush(dataIn.readBoolean());
+ info.setStart(dataIn.readBoolean());
+ info.setStop(dataIn.readBoolean());
+ }
+
+ /**
+ * 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);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeBoolean(info.isClose());
+ looseMarshalNestedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeInt(info.getPrefetch());
+ dataOut.writeBoolean(info.isFlush());
+ dataOut.writeBoolean(info.isStart());
+ dataOut.writeBoolean(info.isStop());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerIdMarshaller.java
new file mode 100644
index 0000000..aa91188
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/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.v8;
+
+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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..453116a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ConsumerInfoMarshaller.java
@@ -0,0 +1,248 @@
+/**
+ * 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.v8;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+ rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), 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);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ ConsumerId value[] = new ConsumerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setNetworkConsumerPath(value);
+ } else {
+ info.setNetworkConsumerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ControlCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ControlCommandMarshaller.java
new file mode 100644
index 0000000..3da05b0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v8/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v8;
+
+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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
[32/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MarshallingGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MarshallingGenerator.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MarshallingGenerator.java
new file mode 100644
index 0000000..b03c603
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MarshallingGenerator.java
@@ -0,0 +1,712 @@
+/**
+ * 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;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.codehaus.jam.JAnnotation;
+import org.codehaus.jam.JAnnotationValue;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JPackage;
+import org.codehaus.jam.JProperty;
+
+/**
+ * Generates the binary marshalers for the OpenWire commands.
+ */
+public class MarshallingGenerator extends MultiSourceGenerator {
+
+ protected List<JClass> concreteClasses = new ArrayList<JClass>();
+ protected File factoryFile;
+ protected String factoryFileName = "MarshallerFactory";
+ protected String indent = " ";
+
+ private final String packagePrefixPath = codecPackageRoot.replace('.', '/');
+
+ public MarshallingGenerator() {
+ this.targetDir = "src/main/java";
+ }
+
+ @Override
+ public Object run() {
+ if (destDir == null) {
+ destDir = new File(getTargetDir() + "/" + packagePrefixPath + "/v" + getOpenwireVersion());
+ }
+ Object answer = super.run();
+ //processFactory();
+ return answer;
+ }
+
+ @Override
+ protected void generateFile(PrintWriter out) throws Exception {
+
+ generateLicence(out);
+ out.println("");
+ out.println("package " + getCodecPackageRoot() + ".v" + getOpenwireVersion() + ";");
+ out.println("");
+ out.println("import java.io.DataInput;");
+ out.println("import java.io.DataOutput;");
+ out.println("import java.io.IOException;");
+ out.println("");
+ out.println("import " + getCodecPackageRoot() + ".*;");
+ out.println("import " + getCommandsPackage() + ".*;");
+ out.println("");
+
+ for (JPackage pkg : getJclass().getImportedPackages()) {
+ for (JClass clazz : pkg.getClasses()) {
+ out.println("import " + clazz.getQualifiedName() + ";");
+ }
+ }
+
+ out.println("");
+ out.println("/**");
+ out.println(" * Marshalling code for Open Wire for " + getClassName() + "");
+ out.println(" *");
+ out.println(" * NOTE!: This file is auto generated - do not modify!");
+ out.println(" *");
+ out.println(" */");
+ out.println("public " + getAbstractClassText() + "class " + getClassName() + " extends " + getBaseClass() + " {");
+ out.println("");
+
+ if (!isAbstractClass()) {
+
+ out.println(" /**");
+ out.println(" * Return the type of Data Structure we marshal");
+ out.println(" * @return short representation of the type data structure");
+ out.println(" */");
+ out.println(" public byte getDataStructureType() {");
+ out.println(" return " + getJclass().getSimpleName() + ".DATA_STRUCTURE_TYPE;");
+ out.println(" }");
+ out.println(" ");
+ out.println(" /**");
+ out.println(" * @return a new object instance");
+ out.println(" */");
+ out.println(" public DataStructure createObject() {");
+ out.println(" return new " + getJclass().getSimpleName() + "();");
+ out.println(" }");
+ out.println("");
+ }
+
+ out.println(" /**");
+ out.println(" * Un-marshal an object instance from the data input stream");
+ out.println(" *");
+ out.println(" * @param o the object to un-marshal");
+ out.println(" * @param dataIn the data input stream to build the object from");
+ out.println(" * @throws IOException");
+ out.println(" */");
+ out.println(" public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {");
+ out.println(" super.tightUnmarshal(wireFormat, o, dataIn, bs);");
+
+ if (!getProperties().isEmpty()) {
+ out.println("");
+ out.println(" " + getJclass().getSimpleName() + " info = (" + getJclass().getSimpleName() + ")o;");
+ }
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.beforeUnmarshall(wireFormat);");
+ out.println(" ");
+ }
+
+ generateTightUnmarshalBody(out);
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.afterUnmarshall(wireFormat);");
+ }
+
+ out.println("");
+ out.println(" }");
+ out.println("");
+ out.println("");
+ out.println(" /**");
+ out.println(" * Write the booleans that this object uses to a BooleanStream");
+ out.println(" */");
+ out.println(" public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {");
+
+ if (!getProperties().isEmpty()) {
+ out.println("");
+ out.println(" " + getJclass().getSimpleName() + " info = (" + getJclass().getSimpleName() + ")o;");
+ }
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.beforeMarshall(wireFormat);");
+ }
+
+ out.println("");
+ out.println(" int rc = super.tightMarshal1(wireFormat, o, bs);");
+ int baseSize = generateTightMarshal1Body(out);
+
+ out.println("");
+ out.println(" return rc + " + baseSize + ";");
+ out.println(" }");
+ out.println("");
+ out.println(" /**");
+ out.println(" * Write a object instance to data output stream");
+ out.println(" *");
+ out.println(" * @param o the instance to be marshaled");
+ out.println(" * @param dataOut the output stream");
+ out.println(" * @throws IOException thrown if an error occurs");
+ out.println(" */");
+ out.println(" public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {");
+ out.println(" super.tightMarshal2(wireFormat, o, dataOut, bs);");
+ if (!getProperties().isEmpty()) {
+ out.println("");
+ out.println(" " + getJclass().getSimpleName() + " info = (" + getJclass().getSimpleName() + ")o;");
+ }
+
+ generateTightMarshal2Body(out);
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.afterMarshall(wireFormat);");
+ }
+
+ out.println("");
+ out.println(" }");
+ out.println("");
+ out.println(" /**");
+ out.println(" * Un-marshal an object instance from the data input stream");
+ out.println(" *");
+ out.println(" * @param o the object to un-marshal");
+ out.println(" * @param dataIn the data input stream to build the object from");
+ out.println(" * @throws IOException");
+ out.println(" */");
+ out.println(" public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {");
+ out.println(" super.looseUnmarshal(wireFormat, o, dataIn);");
+
+ if (!getProperties().isEmpty()) {
+ out.println("");
+ out.println(" " + getJclass().getSimpleName() + " info = (" + getJclass().getSimpleName() + ")o;");
+ }
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.beforeUnmarshall(wireFormat);");
+ out.println(" ");
+ }
+
+ generateLooseUnmarshalBody(out);
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.afterUnmarshall(wireFormat);");
+ }
+
+ out.println("");
+ out.println(" }");
+ out.println("");
+ out.println("");
+ out.println(" /**");
+ out.println(" * Write the booleans that this object uses to a BooleanStream");
+ out.println(" */");
+ out.println(" public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {");
+
+ if (!getProperties().isEmpty()) {
+ out.println("");
+ out.println(" " + getJclass().getSimpleName() + " info = (" + getJclass().getSimpleName() + ")o;");
+ }
+
+ if (isMarshallerAware()) {
+ out.println("");
+ out.println(" info.beforeMarshall(wireFormat);");
+ }
+
+ out.println("");
+ out.println(" super.looseMarshal(wireFormat, o, dataOut);");
+
+ generateLooseMarshalBody(out);
+
+ out.println("");
+ out.println(" }");
+ out.println("}");
+ }
+
+ private void generateLicence(PrintWriter out) {
+ out.println("/**");
+ out.println(" *");
+ out.println(" * Licensed to the Apache Software Foundation (ASF) under one or more");
+ out.println(" * contributor license agreements. See the NOTICE file distributed with");
+ out.println(" * this work for additional information regarding copyright ownership.");
+ out.println(" * The ASF licenses this file to You under the Apache License, Version 2.0");
+ out.println(" * (the \"License\"); you may not use this file except in compliance with");
+ out.println(" * the License. You may obtain a copy of the License at");
+ out.println(" *");
+ out.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+ out.println(" *");
+ out.println(" * Unless required by applicable law or agreed to in writing, software");
+ out.println(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
+ out.println(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+ out.println(" * See the License for the specific language governing permissions and");
+ out.println(" * limitations under the License.");
+ out.println(" */");
+ }
+
+ protected void processFactory() {
+ if (factoryFile == null) {
+ factoryFile = new File(destDir, factoryFileName + filePostFix);
+ }
+ PrintWriter out = null;
+ try {
+ out = new PrintWriter(new FileWriter(factoryFile));
+ generateFactory(out);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+
+ protected void generateFactory(PrintWriter out) {
+ generateLicence(out);
+ out.println("");
+ out.println("package " + getCodecPackageRoot() + ".v" + getOpenwireVersion() + ";");
+ out.println("");
+ out.println("import " + getCodecPackageRoot() + ".DataStreamMarshaller;");
+ out.println("import " + getCodecPackageRoot() + ".OpenWireFormat;");
+ out.println("");
+ out.println("/**");
+ out.println(" * MarshallerFactory for Open Wire Format.");
+ out.println(" *");
+ out.println(" *");
+ out.println(" * NOTE!: This file is auto generated - do not modify!");
+ out.println(" * ");
+ out.println(" */");
+ out.println("public class MarshallerFactory {");
+ out.println("");
+ out.println(" /**");
+ out.println(" * Creates a Map of command type -> Marshallers");
+ out.println(" */");
+ out.println(" static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];");
+ out.println(" static {");
+ out.println("");
+
+ List<JClass> list = new ArrayList<JClass>(getConcreteClasses());
+ Collections.sort(list, new Comparator<JClass>() {
+ @Override
+ public int compare(JClass o1, JClass o2) {
+ return o1.getSimpleName().compareTo(o2.getSimpleName());
+ }
+ });
+
+ for (Iterator<JClass> iter = list.iterator(); iter.hasNext();) {
+ JClass jclass = iter.next();
+ out.println(" add(new " + jclass.getSimpleName() + "Marshaller());");
+ }
+
+ out.println("");
+ out.println(" }");
+ out.println("");
+ out.println(" static private void add(DataStreamMarshaller dsm) {");
+ out.println(" marshaller[dsm.getDataStructureType()] = dsm;");
+ out.println(" }");
+ out.println(" ");
+ out.println(" static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {");
+ out.println(" return marshaller;");
+ out.println(" }");
+ out.println("}");
+ }
+
+ @Override
+ protected void processClass(JClass jclass) {
+ super.processClass(jclass);
+
+ if (!jclass.isAbstract()) {
+ concreteClasses.add(jclass);
+ }
+ }
+
+ @Override
+ protected String getClassName(JClass jclass) {
+ return super.getClassName(jclass) + "Marshaller";
+ }
+
+ @Override
+ protected String getBaseClassName(JClass jclass) {
+ String answer = "BaseDataStreamMarshaller";
+ JClass superclass = jclass.getSuperclass();
+ if (superclass != null) {
+ String superName = superclass.getSimpleName();
+ if (!superName.equals("Object") && !superName.equals("JNDIBaseStorable") && !superName.equals("DataStructureSupport")) {
+ answer = superName + "Marshaller";
+ }
+ }
+ return answer;
+ }
+
+ @Override
+ protected void initialiseManuallyMaintainedClasses() {
+ }
+
+ protected void generateTightUnmarshalBody(PrintWriter out) {
+ for (JProperty property : getProperties()) {
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ JAnnotationValue size = annotation.getValue("size");
+ JClass propertyType = property.getType();
+ String propertyTypeName = propertyType.getSimpleName();
+
+ if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
+ generateTightUnmarshalBodyForArrayProperty(out, property, size);
+ } else {
+ generateTightUnmarshalBodyForProperty(out, property, size);
+ }
+ }
+ }
+
+ protected void generateTightUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+ String setter = property.getSetter().getSimpleName();
+ String type = property.getType().getSimpleName();
+
+ if (type.equals("boolean")) {
+ out.println(" info." + setter + "(bs.readBoolean());");
+ } else if (type.equals("byte")) {
+ out.println(" info." + setter + "(dataIn.readByte());");
+ } else if (type.equals("char")) {
+ out.println(" info." + setter + "(dataIn.readChar());");
+ } else if (type.equals("short")) {
+ out.println(" info." + setter + "(dataIn.readShort());");
+ } else if (type.equals("int")) {
+ out.println(" info." + setter + "(dataIn.readInt());");
+ } else if (type.equals("long")) {
+ out.println(" info." + setter + "(tightUnmarshalLong(wireFormat, dataIn, bs));");
+ } else if (type.equals("String")) {
+ out.println(" info." + setter + "(tightUnmarshalString(dataIn, bs));");
+ } else if (type.equals("byte[]")) {
+ if (size != null) {
+ out.println(" info." + setter + "(tightUnmarshalConstByteArray(dataIn, bs, " + size.asInt() + "));");
+ } else {
+ out.println(" info." + setter + "(tightUnmarshalByteArray(dataIn, bs));");
+ }
+ } else if (type.equals("ByteSequence")) {
+ out.println(" info." + setter + "(tightUnmarshalByteSequence(dataIn, bs));");
+ } else if (isThrowable(property.getType())) {
+ out.println(" info." + setter + "((" + property.getType().getQualifiedName() + ") tightUnmarsalThrowable(wireFormat, dataIn, bs));");
+ } else if (isCachedProperty(property)) {
+ out.println(" info." + setter + "((" + property.getType().getQualifiedName() + ") tightUnmarsalCachedObject(wireFormat, dataIn, bs));");
+ } else {
+ out.println(" info." + setter + "((" + property.getType().getQualifiedName() + ") tightUnmarsalNestedObject(wireFormat, dataIn, bs));");
+ }
+ }
+
+ protected void generateTightUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+ JClass propertyType = property.getType();
+ String arrayType = propertyType.getArrayComponentType().getQualifiedName();
+ String setter = property.getSetter().getSimpleName();
+ out.println();
+ if (size != null) {
+ out.println(" {");
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[" + size.asInt() + "];");
+ out.println(" " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
+ out.println(" value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);");
+ out.println(" }");
+ out.println(" info." + setter + "(value);");
+ out.println(" }");
+ } else {
+ out.println(" if (bs.readBoolean()) {");
+ out.println(" short size = dataIn.readShort();");
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[size];");
+ out.println(" for( int i=0; i < size; i++ ) {");
+ out.println(" value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);");
+ out.println(" }");
+ out.println(" info." + setter + "(value);");
+ out.println(" }");
+ out.println(" else {");
+ out.println(" info." + setter + "(null);");
+ out.println(" }");
+ }
+ }
+
+ protected int generateTightMarshal1Body(PrintWriter out) {
+ int baseSize = 0;
+ for (JProperty property : getProperties()) {
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ JAnnotationValue size = annotation.getValue("size");
+ JClass propertyType = property.getType();
+ String type = propertyType.getSimpleName();
+ String getter = "info." + property.getGetter().getSimpleName() + "()";
+
+ if (type.equals("boolean")) {
+ out.println(" bs.writeBoolean(" + getter + ");");
+ } else if (type.equals("byte")) {
+ baseSize += 1;
+ } else if (type.equals("char")) {
+ baseSize += 2;
+ } else if (type.equals("short")) {
+ baseSize += 2;
+ } else if (type.equals("int")) {
+ baseSize += 4;
+ } else if (type.equals("long")) {
+ out.println(" rc+=tightMarshalLong1(wireFormat, " + getter + ", bs);");
+ } else if (type.equals("String")) {
+ out.println(" rc += tightMarshalString1(" + getter + ", bs);");
+ } else if (type.equals("byte[]")) {
+ if (size == null) {
+ out.println(" rc += tightMarshalByteArray1(" + getter + ", bs);");
+ } else {
+ out.println(" rc += tightMarshalConstByteArray1(" + getter + ", bs, " + size.asInt() + ");");
+ }
+ } else if (type.equals("ByteSequence")) {
+ out.println(" rc += tightMarshalByteSequence1(" + getter + ", bs);");
+ } else if (propertyType.isArrayType()) {
+ if (size != null) {
+ out.println(" rc += tightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
+ } else {
+ out.println(" rc += tightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
+ }
+ } else if (isThrowable(propertyType)) {
+ out.println(" rc += tightMarshalThrowable1(wireFormat, " + getter + ", bs);");
+ } else {
+ if (isCachedProperty(property)) {
+ out.println(" rc += tightMarshalCachedObject1(wireFormat, (DataStructure)" + getter + ", bs);");
+ } else {
+ out.println(" rc += tightMarshalNestedObject1(wireFormat, (DataStructure)" + getter + ", bs);");
+ }
+ }
+ }
+ return baseSize;
+ }
+
+ protected void generateTightMarshal2Body(PrintWriter out) {
+ for (JProperty property : getProperties()) {
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ JAnnotationValue size = annotation.getValue("size");
+ JClass propertyType = property.getType();
+ String type = propertyType.getSimpleName();
+ String getter = "info." + property.getGetter().getSimpleName() + "()";
+
+ if (type.equals("boolean")) {
+ out.println(" bs.readBoolean();");
+ } else if (type.equals("byte")) {
+ out.println(" dataOut.writeByte(" + getter + ");");
+ } else if (type.equals("char")) {
+ out.println(" dataOut.writeChar(" + getter + ");");
+ } else if (type.equals("short")) {
+ out.println(" dataOut.writeShort(" + getter + ");");
+ } else if (type.equals("int")) {
+ out.println(" dataOut.writeInt(" + getter + ");");
+ } else if (type.equals("long")) {
+ out.println(" tightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);");
+ } else if (type.equals("String")) {
+ out.println(" tightMarshalString2(" + getter + ", dataOut, bs);");
+ } else if (type.equals("byte[]")) {
+ if (size != null) {
+ out.println(" tightMarshalConstByteArray2(" + getter + ", dataOut, bs, " + size.asInt() + ");");
+ } else {
+ out.println(" tightMarshalByteArray2(" + getter + ", dataOut, bs);");
+ }
+ } else if (type.equals("ByteSequence")) {
+ out.println(" tightMarshalByteSequence2(" + getter + ", dataOut, bs);");
+ } else if (propertyType.isArrayType()) {
+ if (size != null) {
+ out.println(" tightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
+ } else {
+ out.println(" tightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);");
+ }
+ } else if (isThrowable(propertyType)) {
+ out.println(" tightMarshalThrowable2(wireFormat, " + getter + ", dataOut, bs);");
+ } else {
+ if (isCachedProperty(property)) {
+ out.println(" tightMarshalCachedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);");
+ } else {
+ out.println(" tightMarshalNestedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);");
+ }
+ }
+ }
+ }
+
+ protected void generateLooseMarshalBody(PrintWriter out) {
+ for (JProperty property : getProperties()) {
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ JAnnotationValue size = annotation.getValue("size");
+ JClass propertyType = property.getType();
+ String type = propertyType.getSimpleName();
+ String getter = "info." + property.getGetter().getSimpleName() + "()";
+
+ if (type.equals("boolean")) {
+ out.println(" dataOut.writeBoolean(" + getter + ");");
+ } else if (type.equals("byte")) {
+ out.println(" dataOut.writeByte(" + getter + ");");
+ } else if (type.equals("char")) {
+ out.println(" dataOut.writeChar(" + getter + ");");
+ } else if (type.equals("short")) {
+ out.println(" dataOut.writeShort(" + getter + ");");
+ } else if (type.equals("int")) {
+ out.println(" dataOut.writeInt(" + getter + ");");
+ } else if (type.equals("long")) {
+ out.println(" looseMarshalLong(wireFormat, " + getter + ", dataOut);");
+ } else if (type.equals("String")) {
+ out.println(" looseMarshalString(" + getter + ", dataOut);");
+ } else if (type.equals("byte[]")) {
+ if (size != null) {
+ out.println(" looseMarshalConstByteArray(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
+ } else {
+ out.println(" looseMarshalByteArray(wireFormat, " + getter + ", dataOut);");
+ }
+ } else if (type.equals("ByteSequence")) {
+ out.println(" looseMarshalByteSequence(wireFormat, " + getter + ", dataOut);");
+ } else if (propertyType.isArrayType()) {
+ if (size != null) {
+ out.println(" looseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
+ } else {
+ out.println(" looseMarshalObjectArray(wireFormat, " + getter + ", dataOut);");
+ }
+ } else if (isThrowable(propertyType)) {
+ out.println(" looseMarshalThrowable(wireFormat, " + getter + ", dataOut);");
+ } else {
+ if (isCachedProperty(property)) {
+ out.println(" looseMarshalCachedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+ } else {
+ out.println(" looseMarshalNestedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+ }
+ }
+ }
+ }
+
+ protected void generateLooseUnmarshalBody(PrintWriter out) {
+ for (JProperty property : getProperties()) {
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ JAnnotationValue size = annotation.getValue("size");
+ JClass propertyType = property.getType();
+ String propertyTypeName = propertyType.getSimpleName();
+
+ if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
+ generateLooseUnmarshalBodyForArrayProperty(out, property, size);
+ } else {
+ generateLooseUnmarshalBodyForProperty(out, property, size);
+ }
+ }
+ }
+
+ protected void generateLooseUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+ String setter = property.getSetter().getSimpleName();
+ String type = property.getType().getSimpleName();
+
+ if (type.equals("boolean")) {
+ out.println(" info." + setter + "(dataIn.readBoolean());");
+ } else if (type.equals("byte")) {
+ out.println(" info." + setter + "(dataIn.readByte());");
+ } else if (type.equals("char")) {
+ out.println(" info." + setter + "(dataIn.readChar());");
+ } else if (type.equals("short")) {
+ out.println(" info." + setter + "(dataIn.readShort());");
+ } else if (type.equals("int")) {
+ out.println(" info." + setter + "(dataIn.readInt());");
+ } else if (type.equals("long")) {
+ out.println(" info." + setter + "(looseUnmarshalLong(wireFormat, dataIn));");
+ } else if (type.equals("String")) {
+ out.println(" info." + setter + "(looseUnmarshalString(dataIn));");
+ } else if (type.equals("byte[]")) {
+ if (size != null) {
+ out.println(" info." + setter + "(looseUnmarshalConstByteArray(dataIn, " + size.asInt() + "));");
+ } else {
+ out.println(" info." + setter + "(looseUnmarshalByteArray(dataIn));");
+ }
+ } else if (type.equals("ByteSequence")) {
+ out.println(" info." + setter + "(looseUnmarshalByteSequence(dataIn));");
+ } else if (isThrowable(property.getType())) {
+ out.println(" info." + setter + "((" + property.getType().getQualifiedName() + ") looseUnmarsalThrowable(wireFormat, dataIn));");
+ } else if (isCachedProperty(property)) {
+ out.println(" info." + setter + "((" + property.getType().getQualifiedName() + ") looseUnmarsalCachedObject(wireFormat, dataIn));");
+ } else {
+ out.println(" info." + setter + "((" + property.getType().getQualifiedName() + ") looseUnmarsalNestedObject(wireFormat, dataIn));");
+ }
+ }
+
+ protected void generateLooseUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+ JClass propertyType = property.getType();
+ String arrayType = propertyType.getArrayComponentType().getQualifiedName();
+ String setter = property.getSetter().getSimpleName();
+ out.println();
+ if (size != null) {
+ out.println(" {");
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[" + size.asInt() + "];");
+ out.println(" " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
+ out.println(" value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);");
+ out.println(" }");
+ out.println(" info." + setter + "(value);");
+ out.println(" }");
+ } else {
+ out.println(" if (dataIn.readBoolean()) {");
+ out.println(" short size = dataIn.readShort();");
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[size];");
+ out.println(" for( int i=0; i < size; i++ ) {");
+ out.println(" value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);");
+ out.println(" }");
+ out.println(" info." + setter + "(value);");
+ out.println(" }");
+ out.println(" else {");
+ out.println(" info." + setter + "(null);");
+ out.println(" }");
+ }
+ }
+
+ /**
+ * Returns whether or not the given annotation has a mandatory flag on it or
+ * not
+ */
+ protected String getMandatoryFlag(JAnnotation annotation) {
+ JAnnotationValue value = annotation.getValue("mandatory");
+ if (value != null) {
+ String text = value.asString();
+ if (text != null && text.equalsIgnoreCase("true")) {
+ return "true";
+ }
+ }
+ return "false";
+ }
+
+ public List<JClass> getConcreteClasses() {
+ return concreteClasses;
+ }
+
+ public void setConcreteClasses(List<JClass> concreteClasses) {
+ this.concreteClasses = concreteClasses;
+ }
+
+ public File getFactoryFile() {
+ return factoryFile;
+ }
+
+ public void setFactoryFile(File factoryFile) {
+ this.factoryFile = factoryFile;
+ }
+
+ public String getFactoryFileName() {
+ return factoryFileName;
+ }
+
+ public void setFactoryFileName(String factoryFileName) {
+ this.factoryFileName = factoryFileName;
+ }
+
+ public String getIndent() {
+ return indent;
+ }
+
+ public void setIndent(String indent) {
+ this.indent = indent;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MultiSourceGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MultiSourceGenerator.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MultiSourceGenerator.java
new file mode 100644
index 0000000..1a0bcd3
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/MultiSourceGenerator.java
@@ -0,0 +1,265 @@
+/**
+ * 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;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.FixCRLF;
+import org.codehaus.jam.JAnnotation;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JProperty;
+import org.codehaus.jam.JamClassIterator;
+
+/**
+ *
+ */
+public abstract class MultiSourceGenerator extends OpenWireGenerator {
+
+ protected Set<String> manuallyMaintainedClasses = new HashSet<String>();
+ protected File destDir;
+ protected File destFile;
+
+ protected JClass jclass;
+ protected JClass superclass;
+ protected String simpleName;
+ protected String className;
+ protected String baseClass;
+ protected StringBuffer buffer;
+
+ protected String targetDir;
+
+ public MultiSourceGenerator() {
+ initialiseManuallyMaintainedClasses();
+ }
+
+ public Object run() {
+ if (destDir == null) {
+ throw new IllegalArgumentException("No destDir defined!");
+ }
+ System.out.println(getClass().getName() + " generating files in: " + destDir);
+ destDir.mkdirs();
+ buffer = new StringBuffer();
+
+ JamClassIterator iter = getClasses();
+ while (iter.hasNext()) {
+ try {
+ jclass = iter.nextClass();
+ if (isValidClass(jclass)) {
+ processClass(jclass);
+ }
+ } catch (Exception e) {
+ System.err.println("Unable to process: " + jclass);
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns all the valid properties available on the current class
+ */
+ public List<JProperty> getProperties() {
+ List<JProperty> answer = new ArrayList<JProperty>();
+ JProperty[] properties = jclass.getDeclaredProperties();
+ for (int i = 0; i < properties.length; i++) {
+ JProperty property = properties[i];
+ if (isValidProperty(property)) {
+ answer.add(property);
+ }
+ }
+ return answer;
+ }
+
+ protected boolean isValidClass(JClass jclass) {
+ JAnnotation annotation = jclass.getAnnotation("openwire:marshaller");
+ if (annotation == null) {
+ return false;
+ }
+
+ if (!includeInThisVersion(annotation)) {
+ return false;
+ }
+
+ return !manuallyMaintainedClasses.contains(jclass.getSimpleName());
+ }
+
+ protected void processClass(JClass jclass) {
+ simpleName = jclass.getSimpleName();
+ superclass = jclass.getSuperclass();
+
+ System.out.println(getClass().getName() + " processing class: " + simpleName);
+
+ className = getClassName(jclass);
+ destFile = new File(destDir, className + filePostFix);
+ baseClass = getBaseClassName(jclass);
+
+ PrintWriter out = null;
+ try {
+ out = new PrintWriter(new FileWriter(destFile));
+ generateFile(out);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+
+ // Use the FixCRLF Ant Task to make sure the file has consistent
+ // newlines so that SVN does not complain on checkin.
+ Project project = new Project();
+ project.init();
+ FixCRLF fixCRLF = new FixCRLF();
+ fixCRLF.setProject(project);
+ fixCRLF.setSrcdir(destFile.getParentFile());
+ fixCRLF.setIncludes(destFile.getName());
+ fixCRLF.execute();
+ }
+
+ protected abstract void generateFile(PrintWriter out) throws Exception;
+
+ protected String getBaseClassName(JClass jclass) {
+ String answer = "BaseDataStructure";
+ if (superclass != null) {
+ String name = superclass.getSimpleName();
+ if (name != null && !name.equals("Object")) {
+ answer = name;
+ }
+ }
+ return answer;
+ }
+
+ protected String getClassName(JClass jclass) {
+ return jclass.getSimpleName();
+ }
+
+ public boolean isAbstractClass() {
+ return jclass != null && jclass.isAbstract();
+ }
+
+ public String getAbstractClassText() {
+ return isAbstractClass() ? "abstract " : "";
+ }
+
+ public boolean isMarshallerAware() {
+ return isMarshallAware(jclass);
+ }
+
+ protected void initialiseManuallyMaintainedClasses() {
+ String[] names = {
+ "OpenWireDestination",
+ "OpenWireTempDestination",
+ "OpenWireQueue",
+ "OpenWireTopic",
+ "OpenWireTempQueue",
+ "OpenWireTempTopic",
+ "OpenWireMessage",
+ "OpenWireTextMessage",
+ "OpenWireMapMessage",
+ "OpenWireBytesMessage",
+ "OpenWireStreamMessage",
+ "OpenWireBlobMessage",
+ "OpenWireObjectMessage",
+ "BaseCommand",
+ "DataStructureSupport",
+ "WireFormatInfo"
+ };
+
+ for (int i = 0; i < names.length; i++) {
+ manuallyMaintainedClasses.add(names[i]);
+ }
+ }
+
+ public String getBaseClass() {
+ return baseClass;
+ }
+
+ public void setBaseClass(String baseClass) {
+ this.baseClass = baseClass;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public File getDestDir() {
+ return destDir;
+ }
+
+ public void setDestDir(File destDir) {
+ this.destDir = destDir;
+ }
+
+ public File getDestFile() {
+ return destFile;
+ }
+
+ public void setDestFile(File destFile) {
+ this.destFile = destFile;
+ }
+
+ public JClass getJclass() {
+ return jclass;
+ }
+
+ public void setJclass(JClass jclass) {
+ this.jclass = jclass;
+ }
+
+ public Set<String> getManuallyMaintainedClasses() {
+ return manuallyMaintainedClasses;
+ }
+
+ public void setManuallyMaintainedClasses(Set<String> manuallyMaintainedClasses) {
+ this.manuallyMaintainedClasses = manuallyMaintainedClasses;
+ }
+
+ public String getSimpleName() {
+ return simpleName;
+ }
+
+ public void setSimpleName(String simpleName) {
+ this.simpleName = simpleName;
+ }
+
+ public JClass getSuperclass() {
+ return superclass;
+ }
+
+ public void setSuperclass(JClass superclass) {
+ this.superclass = superclass;
+ }
+
+ public String getTargetDir() {
+ return targetDir;
+ }
+
+ public void setTargetDir(String sourceDir) {
+ this.targetDir = sourceDir;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/OpenWireGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/OpenWireGenerator.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/OpenWireGenerator.java
new file mode 100644
index 0000000..dfd9a61
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/OpenWireGenerator.java
@@ -0,0 +1,178 @@
+/**
+ * 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;
+
+import org.codehaus.jam.JAnnotation;
+import org.codehaus.jam.JAnnotationValue;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JField;
+import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JProperty;
+import org.codehaus.jam.JamClassIterator;
+import org.codehaus.jam.JamService;
+
+/**
+ *
+ */
+public abstract class OpenWireGenerator {
+
+ protected int openwireVersion;
+ protected String filePostFix = ".java";
+ protected JamService jam;
+
+ protected String commandsPackage = "org.apache.activemq.openwire.commands";
+ protected String codecPackageRoot = "org.apache.activemq.openwire.codec";
+
+ public boolean isValidProperty(JProperty it) {
+ JMethod getter = it.getGetter();
+ JMethod setter = it.getSetter();
+
+ if (getter == null || setter == null || getter.isStatic()) {
+ return false;
+ }
+
+ JAnnotation annotation = getter.getAnnotation("openwire:property");
+ if (annotation == null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean includeInThisVersion(JAnnotation annotation) {
+ JAnnotationValue value = annotation.getValue("version");
+ if (value != null && value.asInt() <= getOpenwireVersion()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean isCachedProperty(JProperty it) {
+ JMethod getter = it.getGetter();
+ if (!isValidProperty(it)) {
+ return false;
+ }
+ JAnnotationValue value = getter.getAnnotation("openwire:property").getValue("cache");
+ return value != null && value.asBoolean();
+ }
+
+ public boolean isAbstract(JClass j) {
+ JField[] fields = j.getFields();
+ for (int i = 0; i < fields.length; i++) {
+ JField field = fields[i];
+ if (field.isStatic() && field.isPublic() && field.isFinal() && field.getSimpleName().equals("DATA_STRUCTURE_TYPE")) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isThrowable(JClass j) {
+ if (j.getQualifiedName().equals(Throwable.class.getName())) {
+ return true;
+ }
+ return j.getSuperclass() != null && isThrowable(j.getSuperclass());
+ }
+
+ public boolean isMarshallAware(JClass j) {
+ if (filePostFix.endsWith("java")) {
+ JClass[] interfaces = j.getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ if (interfaces[i].getQualifiedName().equals("org.apache.activemq.command.MarshallAware")) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ String simpleName = j.getSimpleName();
+ return simpleName.equals("ActiveMQMessage") || simpleName.equals("WireFormatInfo");
+ }
+ }
+
+ public JamService getJam() {
+ return jam;
+ }
+
+ public JamClassIterator getClasses() {
+ return getJam().getClasses();
+ }
+
+ public int getOpenwireVersion() {
+ return openwireVersion;
+ }
+
+ public void setOpenwireVersion(int openwireVersion) {
+ this.openwireVersion = openwireVersion;
+ }
+
+ public String getCommandsPackage() {
+ return commandsPackage;
+ }
+
+ public void setCommandsPackage(String commandsPacakge) {
+ this.commandsPackage = commandsPacakge;
+ }
+
+ public String getCodecPackageRoot() {
+ return codecPackageRoot;
+ }
+
+ public void setCodecPackageRoot(String codecPackageRoot) {
+ this.codecPackageRoot = codecPackageRoot;
+ }
+
+ public String getOpenWireOpCode(JClass element) {
+ if (element != null) {
+ JAnnotation annotation = element.getAnnotation("openwire:marshaller");
+ return stringValue(annotation, "code", "0");
+ }
+ return "0";
+ }
+
+ protected String stringValue(JAnnotation annotation, String name) {
+ return stringValue(annotation, name, null);
+ }
+
+ protected String stringValue(JAnnotation annotation, String name, String defaultValue) {
+ if (annotation != null) {
+ JAnnotationValue value = annotation.getValue(name);
+ if (value != null) {
+ return value.asString();
+ }
+ }
+ return defaultValue;
+ }
+
+ public void setJam(JamService jam) {
+ this.jam = jam;
+ }
+
+ public String decapitalize(String text) {
+ if (text == null) {
+ return null;
+ }
+ return text.substring(0, 1).toLowerCase() + text.substring(1);
+ }
+
+ public String capitalize(String text) {
+ if (text == null) {
+ return null;
+ }
+ return text.substring(0, 1).toUpperCase() + text.substring(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestDataGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestDataGenerator.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestDataGenerator.java
new file mode 100644
index 0000000..6951a91
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestDataGenerator.java
@@ -0,0 +1,66 @@
+/**
+ * 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;
+
+/**
+ * A simple helper class to help auto-generate test data when code generating test cases
+ *
+ *
+ */
+public class TestDataGenerator {
+ private int stringCounter;
+
+ private boolean boolCounter;
+ private byte byteCounter;
+ private char charCounter = 'a';
+ private short shortCounter;
+ private int intCounter;
+ private long longCounter;
+
+ public String createByte() {
+ return "(byte) " + (++byteCounter);
+ }
+
+ public String createChar() {
+ return "'" + (charCounter++) + "'";
+ }
+
+ public String createShort() {
+ return "(short) " + (++shortCounter);
+ }
+
+ public int createInt() {
+ return ++intCounter;
+ }
+
+ public long createLong() {
+ return ++longCounter;
+ }
+
+ public String createString(String property) {
+ return property + ":" + (++stringCounter);
+ }
+
+ public boolean createBool() {
+ boolCounter = !boolCounter;
+ return boolCounter;
+ }
+
+ public String createByteArray(String property) {
+ return "\"" + createString(property) + "\".getBytes()";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestsGenerator.java
----------------------------------------------------------------------
diff --git a/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestsGenerator.java b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestsGenerator.java
new file mode 100644
index 0000000..5e7e6f9
--- /dev/null
+++ b/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/TestsGenerator.java
@@ -0,0 +1,198 @@
+/**
+ * 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;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.List;
+
+import org.codehaus.jam.JAnnotation;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JPackage;
+import org.codehaus.jam.JProperty;
+
+/**
+ * Generates the test classes for the OpenWire marshalers.
+ */
+public class TestsGenerator extends MultiSourceGenerator {
+
+ public TestsGenerator() {
+ this.targetDir = "src/test/java";
+ }
+
+ @Override
+ public Object run() {
+ if (destDir == null) {
+ destDir = new File(targetDir + "/io/openwire/codec/v" + getOpenwireVersion());
+ }
+ return super.run();
+ }
+
+ @Override
+ protected String getClassName(JClass jclass) {
+ if (isAbstract(jclass)) {
+ return super.getClassName(jclass) + "TestSupport";
+ } else {
+ return super.getClassName(jclass) + "Test";
+ }
+ }
+
+ @Override
+ protected String getBaseClassName(JClass jclass) {
+ String answer = "DataFileGeneratorTestSupport";
+ if (superclass != null) {
+ String name = superclass.getSimpleName();
+ if (name != null && !name.equals("JNDIBaseStorable") && !name.equals("DataStructureSupport") && !name.equals("Object")) {
+ answer = name + "Test";
+ if (isAbstract(getJclass().getSuperclass())) {
+ answer += "Support";
+ }
+ }
+ }
+ return answer;
+ }
+
+ private void generateLicence(PrintWriter out) {
+ out.println("/**");
+ out.println(" *");
+ out.println(" * Licensed to the Apache Software Foundation (ASF) under one or more");
+ out.println(" * contributor license agreements. See the NOTICE file distributed with");
+ out.println(" * this work for additional information regarding copyright ownership.");
+ out.println(" * The ASF licenses this file to You under the Apache License, Version 2.0");
+ out.println(" * (the \"License\"); you may not use this file except in compliance with");
+ out.println(" * the License. You may obtain a copy of the License at");
+ out.println(" *");
+ out.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+ out.println(" *");
+ out.println(" * Unless required by applicable law or agreed to in writing, software");
+ out.println(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
+ out.println(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+ out.println(" * See the License for the specific language governing permissions and");
+ out.println(" * limitations under the License.");
+ out.println(" */");
+ }
+
+ @Override
+ protected void generateFile(PrintWriter out) {
+
+ generateLicence(out);
+
+ out.println("package " + getCodecPackageRoot() + ".v" + openwireVersion + ";");
+ out.println("");
+ out.println("import java.io.DataInputStream;");
+ out.println("import java.io.DataOutputStream;");
+ out.println("import java.io.IOException;");
+ out.println("");
+ out.println("import " + getCodecPackageRoot() + ".*;");
+ out.println("import " + getCommandsPackage() + ".*;");
+ out.println("");
+
+ for (JPackage pkg : getJclass().getImportedPackages()) {
+ for (JClass clazz : pkg.getClasses()) {
+ out.println("import " + clazz.getQualifiedName() + ";");
+ }
+ }
+
+ out.println("");
+ out.println("/**");
+ out.println(" * Test case for the OpenWire marshalling for " + jclass.getSimpleName() + "");
+ out.println(" *");
+ out.println(" * NOTE!: This file is auto generated - do not modify!");
+ out.println(" * ");
+ out.println(" */");
+ out.println("public " + getAbstractClassText() + "class " + className + " extends " + baseClass + " {");
+ out.println("");
+ if (!isAbstractClass()) {
+ out.println("");
+ out.println(" public static " + jclass.getSimpleName() + "Test SINGLETON = new " + jclass.getSimpleName() + "Test();");
+ out.println("");
+ out.println(" public Object createObject() throws Exception {");
+ out.println(" " + jclass.getSimpleName() + " info = new " + jclass.getSimpleName() + "();");
+ out.println(" populateObject(info);");
+ out.println(" return info;");
+ out.println(" }");
+ }
+ out.println("");
+ out.println(" protected void populateObject(Object object) throws Exception {");
+ out.println(" super.populateObject(object);");
+ out.println(" " + getJclass().getSimpleName() + " info = (" + getJclass().getSimpleName() + ") object;");
+ out.println("");
+
+ TestDataGenerator generator = new TestDataGenerator();
+
+ List<JProperty> properties = getProperties();
+ for (JProperty property : properties) {
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ String size = stringValue(annotation, "size");
+ String testSize = stringValue(annotation, "testSize");
+ String type = property.getType().getSimpleName();
+ String propertyName = property.getSimpleName();
+ if ("-1".equals(testSize)) {
+ continue;
+ }
+
+ String setterName = property.getSetter().getSimpleName();
+
+ if (type.equals("boolean")) {
+ out.println(" info." + setterName + "(" + generator.createBool() + ");");
+ } else if (type.equals("byte")) {
+ out.println(" info." + setterName + "(" + generator.createByte() + ");");
+ } else if (type.equals("char")) {
+ out.println(" info." + setterName + "(" + generator.createChar() + ");");
+ } else if (type.equals("short")) {
+ out.println(" info." + setterName + "(" + generator.createShort() + ");");
+ } else if (type.equals("int")) {
+ out.println(" info." + setterName + "(" + generator.createInt() + ");");
+ } else if (type.equals("long")) {
+ out.println(" info." + setterName + "(" + generator.createLong() + ");");
+ } else if (type.equals("byte[]")) {
+ out.println(" info." + setterName + "(" + generator.createByteArray(propertyName) + ");");
+ } else if (type.equals("String")) {
+ out.println(" info." + setterName + "(\"" + generator.createString(propertyName) + "\");");
+ } else if (type.equals("ByteSequence")) {
+ out.println(" {");
+ out.println(" byte data[] = " + generator.createByteArray(propertyName) + ";");
+ out.println(" info." + setterName + "(new org.apache.activemq.util.ByteSequence(data,0,data.length));");
+ out.println("}");
+ } else if (type.equals("Throwable")) {
+ out.println(" info." + setterName + "(createThrowable(\"" + generator.createString(propertyName) + "\"));");
+ } else {
+ if (property.getType().isArrayType()) {
+ String arrayType = property.getType().getArrayComponentType().getSimpleName();
+ if (size == null) {
+ size = "2";
+ }
+ if (arrayType == jclass.getSimpleName()) {
+ size = "0";
+ }
+ out.println(" {");
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[" + size + "];");
+ out.println(" for( int i=0; i < " + size + "; i++ ) {");
+ out.println(" value[i] = create" + arrayType + "(\"" + generator.createString(propertyName) + "\");");
+ out.println(" }");
+ out.println(" info." + setterName + "(value);");
+ out.println(" }");
+ } else {
+ out.println(" info." + setterName + "(create" + type + "(\"" + generator.createString(propertyName) + "\"));");
+ }
+ }
+ }
+
+ out.println(" }");
+ out.println("}");
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/.gitignore
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/.gitignore b/openwire-interop-tests/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/openwire-interop-tests/.gitignore
@@ -0,0 +1 @@
+/target
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/pom.xml
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/pom.xml b/openwire-interop-tests/pom.xml
new file mode 100644
index 0000000..be6174f
--- /dev/null
+++ b/openwire-interop-tests/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-protocol</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openwire-interop-tests</artifactId>
+ <name>openwire-interop-tests</name>
+ <description>Set of interop tests to ensure that the OpenWire codec works with ActiveMQ</description>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <!-- =================================== -->
+ <!-- Test Dependencies -->
+ <!-- =================================== -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>openwire-legacy</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.fusesource.hawtbuf</groupId>
+ <artifactId>hawtbuf</artifactId>
+ </dependency>
+
+ <!-- Pull in ActiveMQ for compatibility testing -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <version>${activemq-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-kahadb-store</artifactId>
+ <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/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/MessageCompressionTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/MessageCompressionTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/MessageCompressionTest.java
new file mode 100644
index 0000000..7aa97d1
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/MessageCompressionTest.java
@@ -0,0 +1,438 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.BytesMessage;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQBytesMessage;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTextMessage;
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+import org.apache.activemq.openwire.util.Wait;
+import org.apache.activemq.openwire.utils.OpenWireConnection;
+import org.apache.activemq.openwire.utils.OpenWireConsumer;
+import org.apache.activemq.openwire.utils.OpenWireProducer;
+import org.apache.activemq.openwire.utils.OpenWireSession;
+import org.junit.Test;
+
+public class MessageCompressionTest extends OpenWireInteropTestSupport {
+
+ // The following text should compress well
+ private static final String TEXT = "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "
+ + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. ";
+
+ public OpenWireQueue getOpenWireQueue() {
+ return new OpenWireQueue(name.getMethodName());
+ }
+
+ public Queue getActiveMQQueue() {
+ return new ActiveMQQueue(name.getMethodName());
+ }
+
+ @Test
+ public void testTextMessageCompressionActiveMQ() throws Exception {
+ sendAMQTextMessage(TEXT);
+ ActiveMQTextMessage message = receiveAMQTextMessage();
+ int compressedSize = message.getContent().getLength();
+
+ sendAMQTextMessage(TEXT, false);
+ message = receiveAMQTextMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testOpenWireTextMessageCompression() throws Exception {
+ sendOpenWireTextMessage(TEXT);
+ OpenWireTextMessage message = receiveOpenWireTextMessage();
+ int compressedSize = message.getContent().getLength();
+
+ sendOpenWireTextMessage(TEXT, false);
+ message = receiveOpenWireTextMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testTextMessageCompressionActiveMQtoOpenWire() throws Exception {
+ sendAMQTextMessage(TEXT);
+ OpenWireTextMessage message = receiveOpenWireTextMessage();
+ int compressedSize = message.getContent().getLength();
+
+ sendAMQTextMessage(TEXT, false);
+ message = receiveOpenWireTextMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testTextMessageCompressionOpenWireToActiveMQ() throws Exception {
+ sendOpenWireTextMessage(TEXT);
+ ActiveMQTextMessage message = receiveAMQTextMessage();
+ int compressedSize = message.getContent().getLength();
+
+ sendOpenWireTextMessage(TEXT, false);
+ message = receiveAMQTextMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testBytesMessageCompressionActiveMQ() throws Exception {
+ sendAMQBytesMessage(TEXT);
+ ActiveMQBytesMessage message = receiveAMQBytesMessage();
+ int compressedSize = message.getContent().getLength();
+ byte[] bytes = new byte[TEXT.getBytes("UTF8").length];
+ message.readBytes(bytes);
+ assertTrue(message.readBytes(new byte[255]) == -1);
+ String rcvString = new String(bytes, "UTF8");
+ assertEquals(TEXT, rcvString);
+ assertTrue(message.isCompressed());
+
+ sendAMQBytesMessage(TEXT, false);
+ message = receiveAMQBytesMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testBytesMessageCompressionOpenWire() throws Exception {
+ sendOpenWireBytesMessage(TEXT);
+ OpenWireBytesMessage message = receiveOpenWireBytesMessage();
+ int compressedSize = message.getContent().getLength();
+ byte[] bytes = message.getBodyBytes();
+ String rcvString = new String(bytes, "UTF8");
+ assertEquals(TEXT, rcvString);
+ assertTrue(message.isCompressed());
+
+ sendOpenWireBytesMessage(TEXT, false);
+ message = receiveOpenWireBytesMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testBytesMessageCompressionActiveMQtoOpenWire() throws Exception {
+ sendAMQBytesMessage(TEXT);
+ OpenWireBytesMessage message = receiveOpenWireBytesMessage();
+ int compressedSize = message.getContent().getLength();
+ byte[] bytes = message.getBodyBytes();
+ String rcvString = new String(bytes, "UTF8");
+ assertEquals(TEXT, rcvString);
+ assertTrue(message.isCompressed());
+
+ sendAMQBytesMessage(TEXT, false);
+ message = receiveOpenWireBytesMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ @Test
+ public void testBytesMessageCompressionOpenWiretoActiveMQ() throws Exception {
+ sendAMQBytesMessage(TEXT);
+ OpenWireBytesMessage message = receiveOpenWireBytesMessage();
+ int compressedSize = message.getContent().getLength();
+ byte[] bytes = message.getBodyBytes();
+ String rcvString = new String(bytes, "UTF8");
+ assertEquals(TEXT, rcvString);
+ assertTrue(message.isCompressed());
+
+ sendAMQBytesMessage(TEXT, false);
+ message = receiveOpenWireBytesMessage();
+ int unCompressedSize = message.getContent().getLength();
+
+ assertTrue("expected: compressed Size '" + compressedSize + "' < unCompressedSize '" + unCompressedSize + "'",
+ compressedSize < unCompressedSize);
+ }
+
+ //---------- Sends and Receives Message Via ActiveMQ Objects -------------//
+
+ private void sendAMQTextMessage(String message) throws Exception {
+ sendAMQTextMessage(TEXT, true);
+ }
+
+ private void sendAMQTextMessage(String message, boolean useCompression) throws Exception {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionURI);
+ factory.setUseCompression(useCompression);
+ ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = session.createProducer(getActiveMQQueue());
+ producer.send(session.createTextMessage(message));
+ connection.close();
+ }
+
+ private ActiveMQTextMessage receiveAMQTextMessage() throws Exception {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionURI);
+ ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(getActiveMQQueue());
+ ActiveMQTextMessage rc = (ActiveMQTextMessage) consumer.receive();
+ connection.close();
+ return rc;
+ }
+
+ private void sendAMQBytesMessage(String message) throws Exception {
+ sendAMQBytesMessage(TEXT, true);
+ }
+
+ private void sendAMQBytesMessage(String message, boolean useCompression) throws Exception {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionURI);
+ factory.setUseCompression(useCompression);
+ ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = session.createProducer(getActiveMQQueue());
+ BytesMessage bytesMessage = session.createBytesMessage();
+ bytesMessage.writeBytes(message.getBytes("UTF8"));
+ producer.send(bytesMessage);
+ connection.close();
+ }
+
+ private ActiveMQBytesMessage receiveAMQBytesMessage() throws Exception {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionURI);
+ ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(getActiveMQQueue());
+ ActiveMQBytesMessage rc = (ActiveMQBytesMessage) consumer.receive();
+ connection.close();
+ return rc;
+ }
+
+ //---------- Send and Receive OpenWire Messages --------------------------//
+
+ private void sendOpenWireTextMessage(String payload) throws Exception {
+ sendOpenWireTextMessage(payload, true);
+ }
+
+ private void sendOpenWireTextMessage(String payload, boolean useCompression) throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ OpenWireConnection connection = new OpenWireConnection();
+ ConnectionInfo connectionInfo = connection.createConnectionInfo();
+ connectionInfo.setClientId(name.getMethodName());
+ assertTrue(request(connectionInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connection.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ OpenWireProducer producerId = sessionId.createOpenWireProducer();
+
+ ProducerInfo info = producerId.createProducerInfo(getOpenWireQueue());
+ info.setDispatchAsync(false);
+ assertTrue(request(info, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueProducers().length);
+
+ OpenWireTextMessage message = new OpenWireTextMessage();
+ message.setUseCompression(useCompression);
+ message.setText(payload);
+ message.setTimestamp(System.currentTimeMillis());
+ message.setMessageId(producerId.getNextMessageId());
+ message.setProducerId(producerId.getProducerId());
+ message.setDestination(getOpenWireQueue());
+ message.onSend();
+
+ assertTrue(request(message, 10, TimeUnit.SECONDS));
+ assertEquals(1, getProxyToQueue(getOpenWireQueue().getPhysicalName()).getQueueSize());
+
+ assertTrue(request(connection.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getCurrentConnectionsCount());
+ disconnect();
+ }
+
+ private void sendOpenWireBytesMessage(String payload) throws Exception {
+ sendOpenWireBytesMessage(payload, true);
+ }
+
+ private void sendOpenWireBytesMessage(String payload, boolean useCompression) throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ OpenWireConnection connection = new OpenWireConnection();
+ ConnectionInfo connectionInfo = connection.createConnectionInfo();
+ connectionInfo.setClientId(name.getMethodName());
+ assertTrue(request(connectionInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connection.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ OpenWireProducer producerId = sessionId.createOpenWireProducer();
+
+ ProducerInfo info = producerId.createProducerInfo(getOpenWireQueue());
+ info.setDispatchAsync(false);
+ assertTrue(request(info, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueProducers().length);
+
+ OpenWireBytesMessage message = new OpenWireBytesMessage();
+ message.setUseCompression(useCompression);
+ message.setBodyBytes(payload.getBytes("UTF8"));
+ message.setTimestamp(System.currentTimeMillis());
+ message.setMessageId(producerId.getNextMessageId());
+ message.setProducerId(producerId.getProducerId());
+ message.setDestination(getOpenWireQueue());
+ message.onSend();
+
+ assertTrue(request(message, 10, TimeUnit.SECONDS));
+ assertEquals(1, getProxyToQueue(getOpenWireQueue().getPhysicalName()).getQueueSize());
+
+ assertTrue(request(connection.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getCurrentConnectionsCount());
+ disconnect();
+ }
+
+ public OpenWireTextMessage receiveOpenWireTextMessage() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ OpenWireConnection connection = new OpenWireConnection();
+ ConnectionInfo connectionInfo = connection.createConnectionInfo();
+ connectionInfo.setClientId(name.getMethodName());
+ assertTrue(request(connectionInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connection.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, getProxyToQueue(getOpenWireQueue().getPhysicalName()).getQueueSize());
+
+ OpenWireConsumer consumerId = sessionId.createOpenWireConsumer();
+ ConsumerInfo consumerInfo = consumerId.createConsumerInfo(getOpenWireQueue());
+ consumerInfo.setDispatchAsync(false);
+ consumerInfo.setPrefetchSize(1);
+ assertTrue(request(consumerInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueSubscribers().length);
+
+ assertTrue("Should have received a message", Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ return messages.size() == 1;
+ }
+ }));
+
+ Message incoming = messages.poll();
+ assertTrue(incoming instanceof OpenWireTextMessage);
+ OpenWireTextMessage received = (OpenWireTextMessage) incoming;
+
+ MessageAck ack = new MessageAck();
+ ack.setAckType(MessageAck.STANDARD_ACK_TYPE);
+ ack.setConsumerId(consumerId.getConsumerId());
+ ack.setDestination(getOpenWireQueue());
+ ack.setLastMessageId(received.getMessageId());
+ ack.setMessageCount(1);
+ assertTrue(request(ack, 60, TimeUnit.SECONDS));
+ assertEquals(0, getProxyToQueue(getOpenWireQueue().getPhysicalName()).getQueueSize());
+
+ assertTrue(request(connection.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getCurrentConnectionsCount());
+ disconnect();
+
+ return received;
+ }
+
+ public OpenWireBytesMessage receiveOpenWireBytesMessage() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ OpenWireConnection connection = new OpenWireConnection();
+ ConnectionInfo connectionInfo = connection.createConnectionInfo();
+ connectionInfo.setClientId(name.getMethodName());
+ assertTrue(request(connectionInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connection.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, getProxyToQueue(getOpenWireQueue().getPhysicalName()).getQueueSize());
+
+ OpenWireConsumer consumerId = sessionId.createOpenWireConsumer();
+ ConsumerInfo consumerInfo = consumerId.createConsumerInfo(getOpenWireQueue());
+ consumerInfo.setDispatchAsync(false);
+ consumerInfo.setPrefetchSize(1);
+ assertTrue(request(consumerInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueSubscribers().length);
+
+ assertTrue("Should have received a message", Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ return messages.size() == 1;
+ }
+ }));
+
+ Message incoming = messages.poll();
+ assertTrue(incoming instanceof OpenWireBytesMessage);
+ OpenWireBytesMessage received = (OpenWireBytesMessage) incoming;
+
+ MessageAck ack = new MessageAck();
+ ack.setAckType(MessageAck.STANDARD_ACK_TYPE);
+ ack.setConsumerId(consumerId.getConsumerId());
+ ack.setDestination(getOpenWireQueue());
+ ack.setLastMessageId(received.getMessageId());
+ ack.setMessageCount(1);
+ assertTrue(request(ack, 60, TimeUnit.SECONDS));
+ assertEquals(0, getProxyToQueue(getOpenWireQueue().getPhysicalName()).getQueueSize());
+
+ assertTrue(request(connection.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getCurrentConnectionsCount());
+ disconnect();
+
+ return received;
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 10;
+ }
+
+ @Override
+ protected boolean isTightEncodingEnabled() {
+ return false;
+ }
+}
[35/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerAck.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerAck.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerAck.java
new file mode 100644
index 0000000..b1bda9b
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerAck.java
@@ -0,0 +1,83 @@
+/**
+ * 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.commands;
+
+/**
+ * A ProducerAck command is sent by a broker to a producer to let it know it has
+ * received and processed messages that it has produced. The producer will be
+ * flow controlled if it does not receive ProducerAck commands back from the
+ * broker.
+ *
+ * @openwire:marshaller code="19" version="3"
+ */
+public class ProducerAck extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.PRODUCER_ACK;
+
+ protected ProducerId producerId;
+ protected int size;
+
+ public ProducerAck() {
+ }
+
+ public ProducerAck(ProducerId producerId, int size) {
+ this.producerId = producerId;
+ this.size = size;
+ }
+
+ public void copy(ProducerAck copy) {
+ super.copy(copy);
+ copy.producerId = producerId;
+ copy.size = size;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processProducerAck(this);
+ }
+
+ /**
+ * The producer id that this ack message is destined for.
+ *
+ * @openwire:property version=3
+ */
+ public ProducerId getProducerId() {
+ return producerId;
+ }
+
+ public void setProducerId(ProducerId producerId) {
+ this.producerId = producerId;
+ }
+
+ /**
+ * The number of bytes that are being acked.
+ *
+ * @openwire:property version=3
+ */
+ public int getSize() {
+ return size;
+ }
+
+ public void setSize(int size) {
+ this.size = size;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerId.java
new file mode 100644
index 0000000..bd9283e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerId.java
@@ -0,0 +1,151 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="123"
+ *
+ */
+public class ProducerId implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.PRODUCER_ID;
+
+ protected String connectionId;
+ protected long sessionId;
+ protected long value;
+
+ protected transient int hashCode;
+ protected transient String key;
+ protected transient SessionId parentId;
+
+ public ProducerId() {
+ }
+
+ public ProducerId(SessionId sessionId, long producerId) {
+ this.connectionId = sessionId.getConnectionId();
+ this.sessionId = sessionId.getValue();
+ this.value = producerId;
+ }
+
+ public ProducerId(ProducerId id) {
+ this.connectionId = id.getConnectionId();
+ this.sessionId = id.getSessionId();
+ this.value = id.getValue();
+ }
+
+ public ProducerId(String producerKey) {
+ // Parse off the producerId
+ int p = producerKey.lastIndexOf(":");
+ if (p >= 0) {
+ value = Long.parseLong(producerKey.substring(p + 1));
+ producerKey = producerKey.substring(0, p);
+ }
+ setProducerSessionKey(producerKey);
+ }
+
+ public SessionId getParentId() {
+ if (parentId == null) {
+ parentId = new SessionId(this);
+ }
+ return parentId;
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != ProducerId.class) {
+ return false;
+ }
+ ProducerId id = (ProducerId)o;
+ return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId);
+ }
+
+ /**
+ * @param sessionKey
+ */
+ private void setProducerSessionKey(String sessionKey) {
+ // Parse off the value
+ int p = sessionKey.lastIndexOf(":");
+ if (p >= 0) {
+ sessionId = Long.parseLong(sessionKey.substring(p + 1));
+ sessionKey = sessionKey.substring(0, p);
+ }
+ // The rest is the value
+ connectionId = sessionKey;
+ }
+
+ @Override
+ public String toString() {
+ if (key == null) {
+ key = connectionId + ":" + sessionId + ":" + value;
+ }
+ return key;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public String getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(String connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getValue() {
+ return value;
+ }
+
+ public void setValue(long producerId) {
+ this.value = producerId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerInfo.java
new file mode 100644
index 0000000..23758b0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ProducerInfo.java
@@ -0,0 +1,141 @@
+/**
+ * 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.commands;
+
+
+/**
+ * @openwire:marshaller code="6"
+ */
+public class ProducerInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.PRODUCER_INFO;
+
+ protected ProducerId producerId;
+ protected OpenWireDestination destination;
+ protected BrokerId[] brokerPath;
+ protected boolean dispatchAsync;
+ protected int windowSize;
+
+ public ProducerInfo() {
+ }
+
+ public ProducerInfo(ProducerId producerId) {
+ this.producerId = producerId;
+ }
+
+ public ProducerInfo(SessionInfo sessionInfo, long producerId) {
+ this.producerId = new ProducerId(sessionInfo.getSessionId(), producerId);
+ }
+
+ public ProducerInfo copy() {
+ ProducerInfo info = new ProducerInfo();
+ copy(info);
+ return info;
+ }
+
+ public void copy(ProducerInfo info) {
+ super.copy(info);
+ info.producerId = producerId;
+ info.destination = destination;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ProducerId getProducerId() {
+ return producerId;
+ }
+
+ public void setProducerId(ProducerId producerId) {
+ this.producerId = producerId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ public RemoveInfo createRemoveCommand() {
+ RemoveInfo command = new RemoveInfo(getProducerId());
+ command.setResponseRequired(isResponseRequired());
+ return command;
+ }
+
+ /**
+ * The route of brokers the command has moved through.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public BrokerId[] getBrokerPath() {
+ return brokerPath;
+ }
+
+ public void setBrokerPath(BrokerId[] brokerPath) {
+ this.brokerPath = brokerPath;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processAddProducer(this);
+ }
+
+ /**
+ * If the broker should dispatch messages from this producer async. Since
+ * sync dispatch could potentally block the producer thread, this could be
+ * an important setting for the producer.
+ *
+ * @openwire:property version=2
+ */
+ public boolean isDispatchAsync() {
+ return dispatchAsync;
+ }
+
+ public void setDispatchAsync(boolean dispatchAsync) {
+ this.dispatchAsync = dispatchAsync;
+ }
+
+ /**
+ * Used to configure the producer window size. A producer will send up to
+ * the configured window size worth of payload data to the broker before
+ * waiting for an Ack that allows him to send more.
+ *
+ * @openwire:property version=3
+ */
+ public int getWindowSize() {
+ return windowSize;
+ }
+
+ public void setWindowSize(int windowSize) {
+ this.windowSize = windowSize;
+ }
+
+ @Override
+ public boolean isProducerInfo() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveInfo.java
new file mode 100644
index 0000000..9aa4b5e
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveInfo.java
@@ -0,0 +1,110 @@
+/**
+ * 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.commands;
+
+import java.io.IOException;
+
+/**
+ * Removes a consumer, producer, session or connection.
+ *
+ * @openwire:marshaller code="12"
+ */
+public class RemoveInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.REMOVE_INFO;
+
+ protected DataStructure objectId;
+ protected long lastDeliveredSequenceId;
+
+ public RemoveInfo() {
+ }
+
+ public RemoveInfo(DataStructure objectId) {
+ this.objectId = objectId;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public DataStructure getObjectId() {
+ return objectId;
+ }
+
+ public void setObjectId(DataStructure objectId) {
+ this.objectId = objectId;
+ }
+
+ /**
+ * @openwire:property version=5 cache=false
+ */
+ public long getLastDeliveredSequenceId() {
+ return lastDeliveredSequenceId;
+ }
+
+ public void setLastDeliveredSequenceId(long lastDeliveredSequenceId) {
+ this.lastDeliveredSequenceId = lastDeliveredSequenceId;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ switch (objectId.getDataStructureType()) {
+ case ConnectionId.DATA_STRUCTURE_TYPE:
+ return visitor.processRemoveConnection((ConnectionId)objectId, lastDeliveredSequenceId);
+ case SessionId.DATA_STRUCTURE_TYPE:
+ return visitor.processRemoveSession((SessionId)objectId, lastDeliveredSequenceId);
+ case ConsumerId.DATA_STRUCTURE_TYPE:
+ return visitor.processRemoveConsumer((ConsumerId)objectId, lastDeliveredSequenceId);
+ case ProducerId.DATA_STRUCTURE_TYPE:
+ return visitor.processRemoveProducer((ProducerId)objectId);
+ default:
+ throw new IOException("Unknown remove command type: " + objectId.getDataStructureType());
+ }
+ }
+
+ /**
+ * Returns true if this event is for a removed connection
+ */
+ public boolean isConnectionRemove() {
+ return objectId.getDataStructureType() == ConnectionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * Returns true if this event is for a removed session
+ */
+ public boolean isSessionRemove() {
+ return objectId.getDataStructureType() == SessionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * Returns true if this event is for a removed consumer
+ */
+ public boolean isConsumerRemove() {
+ return objectId.getDataStructureType() == ConsumerId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * Returns true if this event is for a removed producer
+ */
+ public boolean isProducerRemove() {
+ return objectId.getDataStructureType() == ProducerId.DATA_STRUCTURE_TYPE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveSubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveSubscriptionInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveSubscriptionInfo.java
new file mode 100644
index 0000000..5e04db8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/RemoveSubscriptionInfo.java
@@ -0,0 +1,82 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="9"
+ */
+public class RemoveSubscriptionInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.REMOVE_SUBSCRIPTION_INFO;
+
+ protected ConnectionId connectionId;
+ protected String clientId;
+ protected String subscriptionName;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getSubcriptionName() {
+ return subscriptionName;
+ }
+
+ /**
+ */
+ public void setSubcriptionName(String subscriptionName) {
+ this.subscriptionName = subscriptionName;
+ }
+
+ public String getSubscriptionName() {
+ return subscriptionName;
+ }
+
+ public void setSubscriptionName(String subscriptionName) {
+ this.subscriptionName = subscriptionName;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processRemoveSubscription(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ReplayCommand.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ReplayCommand.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ReplayCommand.java
new file mode 100644
index 0000000..9d1b4c8
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ReplayCommand.java
@@ -0,0 +1,121 @@
+/**
+ * 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.commands;
+
+/**
+ * A general purpose replay command for some kind of producer where ranges of
+ * messages are asked to be replayed. This command is typically used over a
+ * non-reliable transport such as UDP or multicast but could also be used on
+ * TCP/IP if a socket has been re-established.
+ *
+ * @openwire:marshaller code="65"
+ */
+public class ReplayCommand extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.REPLAY;
+
+ private String producerId;
+ private int firstAckNumber;
+ private int lastAckNumber;
+ private int firstNakNumber;
+ private int lastNakNumber;
+
+ public ReplayCommand() {
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ public String getProducerId() {
+ return producerId;
+ }
+
+ /**
+ * Is used to uniquely identify the producer of the sequence
+ *
+ * @openwire:property version=1 cache=false
+ */
+ public void setProducerId(String producerId) {
+ this.producerId = producerId;
+ }
+
+ public int getFirstAckNumber() {
+ return firstAckNumber;
+ }
+
+ /**
+ * Is used to specify the first sequence number being acknowledged as delivered on the transport
+ * so that it can be removed from cache
+ *
+ * @openwire:property version=1
+ */
+ public void setFirstAckNumber(int firstSequenceNumber) {
+ this.firstAckNumber = firstSequenceNumber;
+ }
+
+ public int getLastAckNumber() {
+ return lastAckNumber;
+ }
+
+ /**
+ * Is used to specify the last sequence number being acknowledged as delivered on the transport
+ * so that it can be removed from cache
+ *
+ * @openwire:property version=1
+ */
+ public void setLastAckNumber(int lastSequenceNumber) {
+ this.lastAckNumber = lastSequenceNumber;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return null;
+ }
+
+ /**
+ * Is used to specify the first sequence number to be replayed
+ *
+ * @openwire:property version=1
+ */
+ public int getFirstNakNumber() {
+ return firstNakNumber;
+ }
+
+ public void setFirstNakNumber(int firstNakNumber) {
+ this.firstNakNumber = firstNakNumber;
+ }
+
+ /**
+ * Is used to specify the last sequence number to be replayed
+ *
+ * @openwire:property version=1
+ */
+ public int getLastNakNumber() {
+ return lastNakNumber;
+ }
+
+ public void setLastNakNumber(int lastNakNumber) {
+ this.lastNakNumber = lastNakNumber;
+ }
+
+ @Override
+ public String toString() {
+ return "ReplayCommand {commandId = " + getCommandId() + ", firstNakNumber = " + getFirstNakNumber() + ", lastNakNumber = " + getLastNakNumber() + "}";
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Response.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Response.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Response.java
new file mode 100644
index 0000000..15e8508
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/Response.java
@@ -0,0 +1,56 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="30"
+ */
+public class Response extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.RESPONSE;
+ int correlationId;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public int getCorrelationId() {
+ return correlationId;
+ }
+
+ public void setCorrelationId(int responseId) {
+ this.correlationId = responseId;
+ }
+
+ @Override
+ public boolean isResponse() {
+ return true;
+ }
+
+ public boolean isException() {
+ return false;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionId.java
new file mode 100644
index 0000000..d30b6b2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionId.java
@@ -0,0 +1,122 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="121"
+ */
+public class SessionId implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.SESSION_ID;
+
+ protected String connectionId;
+ protected long value;
+
+ protected transient int hashCode;
+ protected transient String key;
+ protected transient ConnectionId parentId;
+
+ public SessionId() {
+ }
+
+ public SessionId(ConnectionId connectionId, long sessionId) {
+ this.connectionId = connectionId.getValue();
+ this.value = sessionId;
+ }
+
+ public SessionId(SessionId id) {
+ this.connectionId = id.getConnectionId();
+ this.value = id.getValue();
+ }
+
+ public SessionId(ProducerId id) {
+ this.connectionId = id.getConnectionId();
+ this.value = id.getSessionId();
+ }
+
+ public SessionId(ConsumerId id) {
+ this.connectionId = id.getConnectionId();
+ this.value = id.getSessionId();
+ }
+
+ public ConnectionId getParentId() {
+ if (parentId == null) {
+ parentId = new ConnectionId(this);
+ }
+ return parentId;
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ hashCode = connectionId.hashCode() ^ (int)value;
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || o.getClass() != SessionId.class) {
+ return false;
+ }
+ SessionId id = (SessionId)o;
+ return value == id.value && connectionId.equals(id.connectionId);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public String getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(String connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public long getValue() {
+ return value;
+ }
+
+ public void setValue(long sessionId) {
+ this.value = sessionId;
+ }
+
+ @Override
+ public String toString() {
+ if (key == null) {
+ key = connectionId + ":" + value;
+ }
+ return key;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionInfo.java
new file mode 100644
index 0000000..4064c3f
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SessionInfo.java
@@ -0,0 +1,71 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="4"
+ */
+public class SessionInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.SESSION_INFO;
+
+ protected SessionId sessionId;
+
+ public SessionInfo() {
+ sessionId = new SessionId();
+ }
+
+ public SessionInfo(ConnectionInfo connectionInfo, long sessionId) {
+ this.sessionId = new SessionId(connectionInfo.getConnectionId(), sessionId);
+ }
+
+ public SessionInfo(SessionId sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public SessionId getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(SessionId sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public RemoveInfo createRemoveCommand() {
+ RemoveInfo command = new RemoveInfo(getSessionId());
+ command.setResponseRequired(isResponseRequired());
+ return command;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processAddSession(this);
+ }
+
+ @Override
+ public boolean isSessionInfo() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ShutdownInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ShutdownInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ShutdownInfo.java
new file mode 100644
index 0000000..72f67e0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/ShutdownInfo.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller code="11"
+ */
+public class ShutdownInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.SHUTDOWN_INFO;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processShutdown(this);
+ }
+
+ @Override
+ public boolean isShutdownInfo() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SubscriptionInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SubscriptionInfo.java
new file mode 100644
index 0000000..41ffcf6
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/SubscriptionInfo.java
@@ -0,0 +1,154 @@
+/**
+ * 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.commands;
+
+/**
+ * Used to represent a durable subscription.
+ *
+ * @openwire:marshaller code="55"
+ */
+public class SubscriptionInfo implements DataStructure {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.DURABLE_SUBSCRIPTION_INFO;
+
+ protected OpenWireDestination subscribedDestination;
+ protected OpenWireDestination destination;
+ protected String clientId;
+ protected String subscriptionName;
+ protected String selector;
+
+ public SubscriptionInfo() {
+ }
+
+ public SubscriptionInfo(String clientId, String subscriptionName) {
+ this.clientId = clientId;
+ this.subscriptionName = subscriptionName;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ /**
+ * This is the a resolved destination that the subscription is receiving messages from. This
+ * will never be a pattern or a composite destination.
+ *
+ * @openwire:property version=1 cache=true
+ */
+ public OpenWireDestination getDestination() {
+ return destination;
+ }
+
+ public void setDestination(OpenWireDestination destination) {
+ this.destination = destination;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getSelector() {
+ return selector;
+ }
+
+ public void setSelector(String selector) {
+ this.selector = selector;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public String getSubcriptionName() {
+ return subscriptionName;
+ }
+
+ /**
+ * @param subscriptionName
+ * *
+ */
+ public void setSubcriptionName(String subscriptionName) {
+ this.subscriptionName = subscriptionName;
+ }
+
+ public String getSubscriptionName() {
+ return subscriptionName;
+ }
+
+ public void setSubscriptionName(String subscriptionName) {
+ this.subscriptionName = subscriptionName;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " { " + destination + " }";
+ }
+
+ @Override
+ public int hashCode() {
+ int h1 = clientId != null ? clientId.hashCode() : -1;
+ int h2 = subscriptionName != null ? subscriptionName.hashCode() : -1;
+ return h1 ^ h2;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ boolean result = false;
+ if (obj instanceof SubscriptionInfo) {
+ SubscriptionInfo other = (SubscriptionInfo) obj;
+ result = (clientId == null && other.clientId == null ||
+ clientId != null && other.clientId != null && clientId.equals(other.clientId)) &&
+ (subscriptionName == null && other.subscriptionName == null ||
+ subscriptionName != null && other.subscriptionName != null && subscriptionName.equals(other.subscriptionName));
+ }
+ return result;
+ }
+
+ /**
+ * The destination the client originally subscribed to.. This may not match the {@see
+ * getDestination} method if the subscribed destination uses patterns or composites.
+ *
+ * If the subscribed destinations not set, this just returns the destination.
+ *
+ * @openwire:property version=3
+ */
+ public OpenWireDestination getSubscribedDestination() {
+ if (subscribedDestination == null) {
+ return getDestination();
+ }
+ return subscribedDestination;
+ }
+
+ public void setSubscribedDestination(OpenWireDestination subscribedDestination) {
+ this.subscribedDestination = subscribedDestination;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionId.java
new file mode 100644
index 0000000..71be56c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionId.java
@@ -0,0 +1,32 @@
+/**
+ * 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.commands;
+
+/**
+ * @openwire:marshaller
+ */
+public abstract class TransactionId implements DataStructure {
+
+ public abstract boolean isXATransaction();
+ public abstract boolean isLocalTransaction();
+ public abstract String getTransactionKey();
+
+ @Override
+ public boolean isMarshallAware() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionInfo.java
new file mode 100644
index 0000000..698d5e2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/TransactionInfo.java
@@ -0,0 +1,111 @@
+/**
+ * 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.commands;
+
+import java.io.IOException;
+
+/**
+ * @openwire:marshaller code="7"
+ */
+public class TransactionInfo extends BaseCommand {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.TRANSACTION_INFO;
+
+ public static final byte BEGIN = 0;
+ public static final byte PREPARE = 1;
+ public static final byte COMMIT_ONE_PHASE = 2;
+ public static final byte COMMIT_TWO_PHASE = 3;
+ public static final byte ROLLBACK = 4;
+ public static final byte RECOVER = 5;
+ public static final byte FORGET = 6;
+ public static final byte END = 7;
+
+ protected byte type;
+ protected ConnectionId connectionId;
+ protected TransactionId transactionId;
+
+ public TransactionInfo() {
+ }
+
+ public TransactionInfo(ConnectionId connectionId, TransactionId transactionId, byte type) {
+ this.connectionId = connectionId;
+ this.transactionId = transactionId;
+ this.type = type;
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public ConnectionId getConnectionId() {
+ return connectionId;
+ }
+
+ public void setConnectionId(ConnectionId connectionId) {
+ this.connectionId = connectionId;
+ }
+
+ /**
+ * @openwire:property version=1 cache=true
+ */
+ public TransactionId getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(TransactionId transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public byte getType() {
+ return type;
+ }
+
+ public void setType(byte type) {
+ this.type = type;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ switch (type) {
+ case TransactionInfo.BEGIN:
+ return visitor.processBeginTransaction(this);
+ case TransactionInfo.END:
+ return visitor.processEndTransaction(this);
+ case TransactionInfo.PREPARE:
+ return visitor.processPrepareTransaction(this);
+ case TransactionInfo.COMMIT_ONE_PHASE:
+ return visitor.processCommitTransactionOnePhase(this);
+ case TransactionInfo.COMMIT_TWO_PHASE:
+ return visitor.processCommitTransactionTwoPhase(this);
+ case TransactionInfo.ROLLBACK:
+ return visitor.processRollbackTransaction(this);
+ case TransactionInfo.RECOVER:
+ return visitor.processRecoverTransactions(this);
+ case TransactionInfo.FORGET:
+ return visitor.processForgetTransaction(this);
+ default:
+ throw new IOException("Transaction info type unknown: " + type);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/WireFormatInfo.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/WireFormatInfo.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/WireFormatInfo.java
new file mode 100644
index 0000000..f6ceca0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/WireFormatInfo.java
@@ -0,0 +1,395 @@
+/**
+ * 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.commands;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.utils.OpenWireMarshallingSupport;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.ByteArrayInputStream;
+import org.fusesource.hawtbuf.ByteArrayOutputStream;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+/**
+ * @openwire:marshaller code="1"
+ */
+public class WireFormatInfo implements Command, MarshallAware {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO;
+ private static final int MAX_PROPERTY_SIZE = 1024 * 4;
+ private static final byte MAGIC[] = new byte[] { 'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q' };
+
+ protected byte magic[] = MAGIC;
+ protected int version;
+ protected Buffer marshalledProperties;
+
+ protected transient Map<String, Object> properties;
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ @Override
+ public boolean isWireFormatInfo() {
+ return true;
+ }
+
+ @Override
+ public boolean isMarshallAware() {
+ return true;
+ }
+
+ /**
+ * @openwire:property version=1 size=8 testSize=-1
+ */
+ public byte[] getMagic() {
+ return magic;
+ }
+
+ public void setMagic(byte[] magic) {
+ this.magic = magic;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public int getVersion() {
+ return version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ public Buffer getMarshalledProperties() {
+ return marshalledProperties;
+ }
+
+ public void setMarshalledProperties(Buffer marshalledProperties) {
+ this.marshalledProperties = marshalledProperties;
+ }
+
+ // ////////////////////
+ // Implementation Methods.
+ // ////////////////////
+
+ public Object getProperty(String name) throws IOException {
+ if (properties == null) {
+ if (marshalledProperties == null) {
+ return null;
+ }
+ properties = unmarsallProperties(marshalledProperties);
+ }
+ return properties.get(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map<String, Object> getProperties() throws IOException {
+ if (properties == null) {
+ if (marshalledProperties == null) {
+ return Collections.EMPTY_MAP;
+ }
+ properties = unmarsallProperties(marshalledProperties);
+ }
+ return Collections.unmodifiableMap(properties);
+ }
+
+ public void clearProperties() {
+ marshalledProperties = null;
+ properties = null;
+ }
+
+ public void setProperty(String name, Object value) throws IOException {
+ lazyCreateProperties();
+ properties.put(name, value);
+ }
+
+ protected void lazyCreateProperties() throws IOException {
+ if (properties == null) {
+ if (marshalledProperties == null) {
+ properties = new HashMap<String, Object>();
+ } else {
+ properties = unmarsallProperties(marshalledProperties);
+ marshalledProperties = null;
+ }
+ }
+ }
+
+ private Map<String, Object> unmarsallProperties(Buffer marshalledProperties) throws IOException {
+ return OpenWireMarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
+ }
+
+ @Override
+ public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
+ // Need to marshal the properties.
+ if (marshalledProperties == null && properties != null) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream os = new DataOutputStream(baos);
+ OpenWireMarshallingSupport.marshalPrimitiveMap(properties, os);
+ os.close();
+ marshalledProperties = baos.toBuffer();
+ }
+ }
+
+ @Override
+ public void afterMarshall(OpenWireFormat wireFormat) throws IOException {
+ }
+
+ @Override
+ public void beforeUnmarshall(OpenWireFormat wireFormat) throws IOException {
+ }
+
+ @Override
+ public void afterUnmarshall(OpenWireFormat wireFormat) throws IOException {
+ }
+
+ public boolean isValid() {
+ return magic != null && Arrays.equals(magic, MAGIC);
+ }
+
+ @Override
+ public void setResponseRequired(boolean responseRequired) {
+ }
+
+ /**
+ * @throws IOException
+ */
+ public boolean isCacheEnabled() throws IOException {
+ return Boolean.TRUE == getProperty("CacheEnabled");
+ }
+
+ public void setCacheEnabled(boolean cacheEnabled) throws IOException {
+ setProperty("CacheEnabled", cacheEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /**
+ * @throws IOException
+ */
+ public boolean isStackTraceEnabled() throws IOException {
+ return Boolean.TRUE == getProperty("StackTraceEnabled");
+ }
+
+ public void setStackTraceEnabled(boolean stackTraceEnabled) throws IOException {
+ setProperty("StackTraceEnabled", stackTraceEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /**
+ * @throws IOException
+ */
+ public boolean isTcpNoDelayEnabled() throws IOException {
+ return Boolean.TRUE == getProperty("TcpNoDelayEnabled");
+ }
+
+ public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) throws IOException {
+ setProperty("TcpNoDelayEnabled", tcpNoDelayEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /**
+ * @throws IOException
+ */
+ public boolean isSizePrefixDisabled() throws IOException {
+ return Boolean.TRUE == getProperty("SizePrefixDisabled");
+ }
+
+ public void setSizePrefixDisabled(boolean prefixPacketSize) throws IOException {
+ setProperty("SizePrefixDisabled", prefixPacketSize ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /**
+ * @throws IOException
+ */
+ public boolean isTightEncodingEnabled() throws IOException {
+ return Boolean.TRUE == getProperty("TightEncodingEnabled");
+ }
+
+ public void setTightEncodingEnabled(boolean tightEncodingEnabled) throws IOException {
+ setProperty("TightEncodingEnabled", tightEncodingEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ public String getHost() throws IOException {
+ UTF8Buffer buff = (UTF8Buffer) getProperty("Host");
+ if (buff == null) {
+ return null;
+ }
+ return buff.toString();
+ }
+
+ public void setHost(String hostname) throws IOException {
+ setProperty("Host", hostname);
+ }
+
+ /**
+ * @throws IOException
+ */
+ public long getMaxInactivityDuration() throws IOException {
+ Long l = (Long) getProperty("MaxInactivityDuration");
+ return l == null ? 0 : l.longValue();
+ }
+
+ public void setMaxInactivityDuration(long maxInactivityDuration) throws IOException {
+ setProperty("MaxInactivityDuration", new Long(maxInactivityDuration));
+ }
+
+ public long getMaxInactivityDurationInitalDelay() throws IOException {
+ Long l = (Long) getProperty("MaxInactivityDurationInitalDelay");
+ return l == null ? 0 : l.longValue();
+ }
+
+ public void setMaxInactivityDurationInitalDelay(long maxInactivityDurationInitalDelay) throws IOException {
+ setProperty("MaxInactivityDurationInitalDelay", new Long(maxInactivityDurationInitalDelay));
+ }
+
+ public long getMaxFrameSize() throws IOException {
+ Long l = (Long) getProperty("MaxFrameSize");
+ return l == null ? 0 : l.longValue();
+ }
+
+ public void setMaxFrameSize(long maxFrameSize) throws IOException {
+ setProperty("MaxFrameSize", new Long(maxFrameSize));
+ }
+
+ /**
+ * @throws IOException
+ */
+ public int getCacheSize() throws IOException {
+ Integer i = (Integer) getProperty("CacheSize");
+ return i == null ? 0 : i.intValue();
+ }
+
+ public void setCacheSize(int cacheSize) throws IOException {
+ setProperty("CacheSize", new Integer(cacheSize));
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return visitor.processWireFormat(this);
+ }
+
+ @Override
+ public String toString() {
+ Map<String, Object> p = null;
+ try {
+ p = getProperties();
+ } catch (IOException ignore) {
+ }
+ return "WireFormatInfo { version=" + version + ", properties=" + p + ", magic=" + toString(magic) + "}";
+ }
+
+ private String toString(byte[] data) {
+ StringBuffer sb = new StringBuffer();
+ sb.append('[');
+ for (int i = 0; i < data.length; i++) {
+ if (i != 0) {
+ sb.append(',');
+ }
+ sb.append((char) data[i]);
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
+ // /////////////////////////////////////////////////////////////
+ //
+ // This are not implemented.
+ //
+ // /////////////////////////////////////////////////////////////
+
+ @Override
+ public void setCommandId(int value) {
+ }
+
+ @Override
+ public int getCommandId() {
+ return 0;
+ }
+
+ @Override
+ public boolean isResponseRequired() {
+ return false;
+ }
+
+ @Override
+ public boolean isResponse() {
+ return false;
+ }
+
+ @Override
+ public boolean isBrokerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatch() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessage() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageAck() {
+ return false;
+ }
+
+ @Override
+ public boolean isMessageDispatchNotification() {
+ return false;
+ }
+
+ @Override
+ public boolean isShutdownInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectionControl() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectionInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isSessionInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isProducerInfo() {
+ return false;
+ }
+
+ @Override
+ public boolean isConsumerInfo() {
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/XATransactionId.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/XATransactionId.java b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/XATransactionId.java
new file mode 100644
index 0000000..8781386
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/XATransactionId.java
@@ -0,0 +1,257 @@
+/**
+ * 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.commands;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import javax.transaction.xa.Xid;
+
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+
+/**
+ * @openwire:marshaller code="112"
+ */
+public class XATransactionId extends TransactionId implements Xid, Comparable<XATransactionId> {
+
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.OPENWIRE_XA_TRANSACTION_ID;
+
+ private int formatId;
+ private byte[] branchQualifier;
+ private byte[] globalTransactionId;
+ private transient DataByteArrayOutputStream outputStream;
+ private transient byte[] encodedXidBytes;
+
+ private transient int hash;
+ private transient String transactionKey;
+
+ public XATransactionId() {
+ }
+
+ public XATransactionId(Xid xid) {
+ this.formatId = xid.getFormatId();
+ this.globalTransactionId = xid.getGlobalTransactionId();
+ this.branchQualifier = xid.getBranchQualifier();
+ }
+
+ public XATransactionId(byte[] encodedBytes) throws IOException {
+ encodedXidBytes = encodedBytes;
+ initFromEncodedBytes();
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return DATA_STRUCTURE_TYPE;
+ }
+
+ final int XID_PREFIX_SIZE = 16;
+ //+|-,(long)lastAck,(byte)priority,(int)formatid,(short)globalLength....
+ private void initFromEncodedBytes() throws IOException {
+ DataByteArrayInputStream inputStream = new DataByteArrayInputStream(encodedXidBytes);
+ inputStream.skipBytes(10);
+ formatId = inputStream.readInt();
+ int globalLength = inputStream.readShort();
+ globalTransactionId = new byte[globalLength];
+ try {
+ inputStream.read(globalTransactionId);
+ branchQualifier = new byte[inputStream.available()];
+ inputStream.read(branchQualifier);
+ } catch (IOException fatal) {
+ throw new RuntimeException(this + ", failed to decode:", fatal);
+ } finally {
+ inputStream.close();
+ }
+ }
+
+ public synchronized byte[] getEncodedXidBytes() {
+ if (encodedXidBytes == null) {
+ outputStream = new DataByteArrayOutputStream(XID_PREFIX_SIZE + globalTransactionId.length + branchQualifier.length);
+ try {
+ outputStream.position(10);
+ outputStream.writeInt(formatId);
+ outputStream.writeShort(globalTransactionId.length);
+ } catch (IOException fatal) {
+ throw new RuntimeException(this + ", failed to encode:", fatal);
+ }
+ try {
+ outputStream.write(globalTransactionId);
+ outputStream.write(branchQualifier);
+ } catch (IOException fatal) {
+ throw new RuntimeException(this + ", failed to encode:", fatal);
+ }
+ encodedXidBytes = outputStream.getData();
+ }
+ return encodedXidBytes;
+ }
+
+ public DataByteArrayOutputStream internalOutputStream() {
+ return outputStream;
+ }
+
+ @Override
+ public synchronized String getTransactionKey() {
+ if (transactionKey == null) {
+ StringBuffer s = new StringBuffer();
+ s.append("XID:[" + formatId + ",globalId=");
+ s.append(stringForm(formatId, globalTransactionId));
+ s.append(",branchId=");
+ s.append(stringForm(formatId, branchQualifier));
+ s.append("]");
+ transactionKey = s.toString();
+ }
+ return transactionKey;
+ }
+
+ private String stringForm(int format, byte[] uid) {
+ StringBuffer s = new StringBuffer();
+ switch (format) {
+ case 131077: // arjuna
+ stringFormArj(s, uid);
+ break;
+ default: // aries
+ stringFormDefault(s, uid);
+ }
+ return s.toString();
+ }
+
+ private void stringFormDefault(StringBuffer s, byte[] uid) {
+ for (int i = 0; i < uid.length; i++) {
+ s.append(Integer.toHexString(uid[i]));
+ }
+ }
+
+ private void stringFormArj(StringBuffer s, byte[] uid) {
+ DataByteArrayInputStream byteArrayInputStream = null;
+ try {
+ byteArrayInputStream = new DataByteArrayInputStream(uid);
+ s.append(Long.toString(byteArrayInputStream.readLong(), 16));
+ s.append(':');
+ s.append(Long.toString(byteArrayInputStream.readLong(), 16));
+ s.append(':');
+
+ s.append(Integer.toString(byteArrayInputStream.readInt(), 16));
+ s.append(':');
+ s.append(Integer.toString(byteArrayInputStream.readInt(), 16));
+ s.append(':');
+ s.append(Integer.toString(byteArrayInputStream.readInt(), 16));
+ } catch (Exception ignored) {
+ stringFormDefault(s, uid);
+ } finally {
+ try {
+ byteArrayInputStream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getTransactionKey();
+ }
+
+ @Override
+ public boolean isXATransaction() {
+ return true;
+ }
+
+ @Override
+ public boolean isLocalTransaction() {
+ return false;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ @Override
+ public int getFormatId() {
+ return formatId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ @Override
+ public byte[] getGlobalTransactionId() {
+ return globalTransactionId;
+ }
+
+ /**
+ * @openwire:property version=1
+ */
+ @Override
+ public byte[] getBranchQualifier() {
+ return branchQualifier;
+ }
+
+ public void setBranchQualifier(byte[] branchQualifier) {
+ this.branchQualifier = branchQualifier;
+ this.hash = 0;
+ }
+
+ public void setFormatId(int formatId) {
+ this.formatId = formatId;
+ this.hash = 0;
+ }
+
+ public void setGlobalTransactionId(byte[] globalTransactionId) {
+ this.globalTransactionId = globalTransactionId;
+ this.hash = 0;
+ }
+
+ @Override
+ public int hashCode() {
+ if (hash == 0) {
+ hash = formatId;
+ hash = hash(globalTransactionId, hash);
+ hash = hash(branchQualifier, hash);
+ if (hash == 0) {
+ hash = 0xaceace;
+ }
+ }
+ return hash;
+ }
+
+ private static int hash(byte[] bytes, int hash) {
+ int size = bytes.length;
+ for (int i = 0; i < size; i++) {
+ hash ^= bytes[i] << ((i % 4) * 8);
+ }
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null || o.getClass() != XATransactionId.class) {
+ return false;
+ }
+
+ XATransactionId xid = (XATransactionId)o;
+ return xid.formatId == formatId &&
+ Arrays.equals(xid.globalTransactionId, globalTransactionId) &&
+ Arrays.equals(xid.branchQualifier, branchQualifier);
+ }
+
+ @Override
+ public int compareTo(XATransactionId xid) {
+ if (xid == null) {
+ return -1;
+ }
+
+ return getTransactionKey().compareTo(xid.getTransactionKey());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/commands/package.html
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/commands/package.html b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/package.html
new file mode 100644
index 0000000..236b95c
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/commands/package.html
@@ -0,0 +1,24 @@
+<!--
+ 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.
+-->
+<html>
+ <head></head>
+ <body>
+ <p>
+ Represents the Object Model for the OpenWire protocol.
+ </p>
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/CronParser.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/CronParser.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/CronParser.java
new file mode 100644
index 0000000..491f26d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/CronParser.java
@@ -0,0 +1,357 @@
+/**
+ * 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.utils;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.jms.MessageFormatException;
+
+public class CronParser {
+
+ private static final int NUMBER_TOKENS = 5;
+ private static final int MINUTES = 0;
+ private static final int HOURS = 1;
+ private static final int DAY_OF_MONTH = 2;
+ private static final int MONTH = 3;
+ private static final int DAY_OF_WEEK = 4;
+
+ public static long getNextScheduledTime(final String cronEntry, long currentTime) throws MessageFormatException {
+
+ long result = 0;
+
+ if (cronEntry == null || cronEntry.length() == 0) {
+ return result;
+ }
+
+ // Handle the once per minute case "* * * * *"
+ // starting the next event at the top of the minute.
+ if (cronEntry.equals("* * * * *")) {
+ result = currentTime + 60 * 1000;
+ result = result / 60000 * 60000;
+ return result;
+ }
+
+ List<String> list = tokenize(cronEntry);
+ List<CronEntry> entries = buildCronEntries(list);
+ Calendar working = Calendar.getInstance();
+ working.setTimeInMillis(currentTime);
+ working.set(Calendar.SECOND, 0);
+
+ CronEntry minutes = entries.get(MINUTES);
+ CronEntry hours = entries.get(HOURS);
+ CronEntry dayOfMonth = entries.get(DAY_OF_MONTH);
+ CronEntry month = entries.get(MONTH);
+ CronEntry dayOfWeek = entries.get(DAY_OF_WEEK);
+
+ // Start at the top of the next minute, cron is only guaranteed to be
+ // run on the minute.
+ int timeToNextMinute = 60 - working.get(Calendar.SECOND);
+ working.add(Calendar.SECOND, timeToNextMinute);
+
+ // If its already to late in the day this will roll us over to tomorrow
+ // so we'll need to check again when done updating month and day.
+ int currentMinutes = working.get(Calendar.MINUTE);
+ if (!isCurrent(minutes, currentMinutes)) {
+ int nextMinutes = getNext(minutes, currentMinutes);
+ working.add(Calendar.MINUTE, nextMinutes);
+ }
+
+ int currentHours = working.get(Calendar.HOUR_OF_DAY);
+ if (!isCurrent(hours, currentHours)) {
+ int nextHour = getNext(hours, currentHours);
+ working.add(Calendar.HOUR_OF_DAY, nextHour);
+ }
+
+ // We can roll into the next month here which might violate the cron setting
+ // rules so we check once then recheck again after applying the month settings.
+ doUpdateCurrentDay(working, dayOfMonth, dayOfWeek);
+
+ // Start by checking if we are in the right month, if not then calculations
+ // need to start from the beginning of the month to ensure that we don't end
+ // up on the wrong day. (Can happen when DAY_OF_WEEK is set and current time
+ // is ahead of the day of the week to execute on).
+ doUpdateCurrentMonth(working, month);
+
+ // Now Check day of week and day of month together since they can be specified
+ // together in one entry, if both "day of month" and "day of week" are restricted
+ // (not "*"), then either the "day of month" field (3) or the "day of week" field
+ // (5) must match the current day or the Calenday must be advanced.
+ doUpdateCurrentDay(working, dayOfMonth, dayOfWeek);
+
+ // Now we can chose the correct hour and minute of the day in question.
+
+ currentHours = working.get(Calendar.HOUR_OF_DAY);
+ if (!isCurrent(hours, currentHours)) {
+ int nextHour = getNext(hours, currentHours);
+ working.add(Calendar.HOUR_OF_DAY, nextHour);
+ }
+
+ currentMinutes = working.get(Calendar.MINUTE);
+ if (!isCurrent(minutes, currentMinutes)) {
+ int nextMinutes = getNext(minutes, currentMinutes);
+ working.add(Calendar.MINUTE, nextMinutes);
+ }
+
+ result = working.getTimeInMillis();
+
+ if (result <= currentTime) {
+ throw new ArithmeticException("Unable to compute next scheduled exection time.");
+ }
+
+ return result;
+ }
+
+ protected static long doUpdateCurrentMonth(Calendar working, CronEntry month) throws MessageFormatException {
+ int currentMonth = working.get(Calendar.MONTH) + 1;
+ if (!isCurrent(month, currentMonth)) {
+ int nextMonth = getNext(month, currentMonth);
+ working.add(Calendar.MONTH, nextMonth);
+
+ // Reset to start of month.
+ resetToStartOfDay(working, 1);
+
+ return working.getTimeInMillis();
+ }
+
+ return 0L;
+ }
+
+ protected static long doUpdateCurrentDay(Calendar working, CronEntry dayOfMonth, CronEntry dayOfWeek) throws MessageFormatException {
+
+ int currentDayOfWeek = working.get(Calendar.DAY_OF_WEEK) - 1;
+ int currentDayOfMonth = working.get(Calendar.DAY_OF_MONTH);
+
+ // Simplest case, both are unrestricted or both match today otherwise
+ // result must be the closer of the two if both are set, or the next
+ // match to the one that is.
+ if (!isCurrent(dayOfWeek, currentDayOfWeek) || !isCurrent(dayOfMonth, currentDayOfMonth)) {
+
+ int nextWeekDay = Integer.MAX_VALUE;
+ int nextCalendarDay = Integer.MAX_VALUE;
+
+ if (!isCurrent(dayOfWeek, currentDayOfWeek)) {
+ nextWeekDay = getNext(dayOfWeek, currentDayOfWeek);
+ }
+
+ if (!isCurrent(dayOfMonth, currentDayOfMonth)) {
+ nextCalendarDay = getNext(dayOfMonth, currentDayOfMonth);
+ }
+
+ if (nextWeekDay < nextCalendarDay) {
+ working.add(Calendar.DAY_OF_WEEK, nextWeekDay);
+ } else {
+ working.add(Calendar.DAY_OF_MONTH, nextCalendarDay);
+ }
+
+ // Since the day changed, we restart the clock at the start of the day
+ // so that the next time will either be at 12am + value of hours and
+ // minutes pattern.
+ resetToStartOfDay(working, working.get(Calendar.DAY_OF_MONTH));
+
+ return working.getTimeInMillis();
+ }
+
+ return 0L;
+ }
+
+ public static void validate(final String cronEntry) throws MessageFormatException {
+ List<String> list = tokenize(cronEntry);
+ List<CronEntry> entries = buildCronEntries(list);
+ for (CronEntry e : entries) {
+ validate(e);
+ }
+ }
+
+ static void validate(final CronEntry entry) throws MessageFormatException {
+ List<Integer> list = entry.currentWhen;
+ if (list.isEmpty() || list.get(0).intValue() < entry.start || list.get(list.size() - 1).intValue() > entry.end) {
+ throw new MessageFormatException("Invalid token: " + entry);
+ }
+ }
+
+ static int getNext(final CronEntry entry, final int current) throws MessageFormatException {
+ int result = 0;
+
+ if (entry.currentWhen == null) {
+ entry.currentWhen = calculateValues(entry);
+ }
+
+ List<Integer> list = entry.currentWhen;
+ int next = -1;
+ for (Integer i : list) {
+ if (i.intValue() > current) {
+ next = i.intValue();
+ break;
+ }
+ }
+ if (next != -1) {
+ result = next - current;
+ } else {
+ int first = list.get(0).intValue();
+ result = entry.end + first - entry.start - current;
+
+ // Account for difference of one vs zero based indices.
+ if (entry.name.equals("DayOfWeek") || entry.name.equals("Month")) {
+ result++;
+ }
+ }
+
+ return result;
+ }
+
+ static boolean isCurrent(final CronEntry entry, final int current) throws MessageFormatException {
+ boolean result = entry.currentWhen.contains(new Integer(current));
+ return result;
+ }
+
+ protected static void resetToStartOfDay(Calendar target, int day) {
+ target.set(Calendar.DAY_OF_MONTH, day);
+ target.set(Calendar.HOUR_OF_DAY, 0);
+ target.set(Calendar.MINUTE, 0);
+ target.set(Calendar.SECOND, 0);
+ }
+
+ static List<String> tokenize(String cron) throws IllegalArgumentException {
+ StringTokenizer tokenize = new StringTokenizer(cron);
+ List<String> result = new ArrayList<String>();
+ while (tokenize.hasMoreTokens()) {
+ result.add(tokenize.nextToken());
+ }
+ if (result.size() != NUMBER_TOKENS) {
+ throw new IllegalArgumentException("Not a valid cron entry - wrong number of tokens(" + result.size() + "): " + cron);
+ }
+ return result;
+ }
+
+ protected static List<Integer> calculateValues(final CronEntry entry) {
+ List<Integer> result = new ArrayList<Integer>();
+ if (isAll(entry.token)) {
+ for (int i = entry.start; i <= entry.end; i++) {
+ result.add(i);
+ }
+ } else if (isAStep(entry.token)) {
+ int denominator = getDenominator(entry.token);
+ String numerator = getNumerator(entry.token);
+ CronEntry ce = new CronEntry(entry.name, numerator, entry.start, entry.end);
+ List<Integer> list = calculateValues(ce);
+ for (Integer i : list) {
+ if (i.intValue() % denominator == 0) {
+ result.add(i);
+ }
+ }
+ } else if (isAList(entry.token)) {
+ StringTokenizer tokenizer = new StringTokenizer(entry.token, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String str = tokenizer.nextToken();
+ CronEntry ce = new CronEntry(entry.name, str, entry.start, entry.end);
+ List<Integer> list = calculateValues(ce);
+ result.addAll(list);
+ }
+ } else if (isARange(entry.token)) {
+ int index = entry.token.indexOf('-');
+ int first = Integer.parseInt(entry.token.substring(0, index));
+ int last = Integer.parseInt(entry.token.substring(index + 1));
+ for (int i = first; i <= last; i++) {
+ result.add(i);
+ }
+ } else {
+ int value = Integer.parseInt(entry.token);
+ result.add(value);
+ }
+ Collections.sort(result);
+ return result;
+ }
+
+ protected static boolean isARange(String token) {
+ return token != null && token.indexOf('-') >= 0;
+ }
+
+ protected static boolean isAStep(String token) {
+ return token != null && token.indexOf('/') >= 0;
+ }
+
+ protected static boolean isAList(String token) {
+ return token != null && token.indexOf(',') >= 0;
+ }
+
+ protected static boolean isAll(String token) {
+ return token != null && token.length() == 1 && (token.charAt(0) == '*' || token.charAt(0) == '?');
+ }
+
+ protected static int getDenominator(final String token) {
+ int result = 0;
+ int index = token.indexOf('/');
+ String str = token.substring(index + 1);
+ result = Integer.parseInt(str);
+ return result;
+ }
+
+ protected static String getNumerator(final String token) {
+ int index = token.indexOf('/');
+ String str = token.substring(0, index);
+ return str;
+ }
+
+ static List<CronEntry> buildCronEntries(List<String> tokens) {
+
+ List<CronEntry> result = new ArrayList<CronEntry>();
+
+ CronEntry minutes = new CronEntry("Minutes", tokens.get(MINUTES), 0, 60);
+ minutes.currentWhen = calculateValues(minutes);
+ result.add(minutes);
+ CronEntry hours = new CronEntry("Hours", tokens.get(HOURS), 0, 24);
+ hours.currentWhen = calculateValues(hours);
+ result.add(hours);
+ CronEntry dayOfMonth = new CronEntry("DayOfMonth", tokens.get(DAY_OF_MONTH), 1, 31);
+ dayOfMonth.currentWhen = calculateValues(dayOfMonth);
+ result.add(dayOfMonth);
+ CronEntry month = new CronEntry("Month", tokens.get(MONTH), 1, 12);
+ month.currentWhen = calculateValues(month);
+ result.add(month);
+ CronEntry dayOfWeek = new CronEntry("DayOfWeek", tokens.get(DAY_OF_WEEK), 0, 6);
+ dayOfWeek.currentWhen = calculateValues(dayOfWeek);
+ result.add(dayOfWeek);
+
+ return result;
+ }
+
+ static class CronEntry {
+
+ final String name;
+ final String token;
+ final int start;
+ final int end;
+
+ List<Integer> currentWhen;
+
+ CronEntry(String name, String token, int start, int end) {
+ this.name = name;
+ this.token = token;
+ this.start = start;
+ this.end = end;
+ }
+
+ @Override
+ public String toString() {
+ return this.name + ":" + token;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/utils/DefaultUnresolvedDestinationTransformer.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/utils/DefaultUnresolvedDestinationTransformer.java b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/DefaultUnresolvedDestinationTransformer.java
new file mode 100644
index 0000000..e7c6bec
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/utils/DefaultUnresolvedDestinationTransformer.java
@@ -0,0 +1,71 @@
+/**
+ * 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.utils;
+
+import java.lang.reflect.Method;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+
+/**
+ * A default implementation of the resolver that attempts to find an isQueue or isTopic method
+ * on the foreign destination to determine the correct type.
+ */
+public class DefaultUnresolvedDestinationTransformer implements UnresolvedDestinationTransformer {
+
+ @Override
+ public OpenWireDestination transform(Destination dest) throws JMSException {
+ String queueName = ((Queue) dest).getQueueName();
+ String topicName = ((Topic) dest).getTopicName();
+
+ if (queueName == null && topicName == null) {
+ throw new JMSException("Unresolvable destination: Both queue and topic names are null: " + dest);
+ }
+
+ try {
+ Method isQueueMethod = dest.getClass().getMethod("isQueue");
+ Method isTopicMethod = dest.getClass().getMethod("isTopic");
+
+ if (isQueueMethod == null && isTopicMethod == null) {
+ throw new JMSException("Unresolvable destination: Neither isQueue nor isTopic methods present: " + dest);
+ }
+
+ Boolean isQueue = (Boolean) isQueueMethod.invoke(dest);
+ Boolean isTopic = (Boolean) isTopicMethod.invoke(dest);
+ if (isQueue) {
+ return new OpenWireQueue(queueName);
+ } else if (isTopic) {
+ return new OpenWireTopic(topicName);
+ } else {
+ throw new JMSException("Unresolvable destination: Neither Queue nor Topic: " + dest);
+ }
+ } catch (Exception e) {
+ throw new JMSException("Unresolvable destination: " + e.getMessage() + ": " + dest);
+ }
+ }
+
+ @Override
+ public OpenWireDestination transform(String dest) throws JMSException {
+ return new OpenWireQueue(dest);
+ }
+}
[05/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchMarshaller.java
new file mode 100644
index 0000000..aafc0e6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchMarshaller.java
@@ -0,0 +1,140 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatch.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatch();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+
+ /**
+ * 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);
+
+ MessageDispatch info = (MessageDispatch) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setRedeliveryCounter(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageDispatch info = (MessageDispatch) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut);
+ dataOut.writeInt(info.getRedeliveryCounter());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchNotificationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchNotificationMarshaller.java
new file mode 100644
index 0000000..9b03961
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageDispatchNotificationMarshaller.java
@@ -0,0 +1,141 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageDispatchNotification;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageDispatchNotification.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageDispatchNotification();
+ }
+
+ /**
+ * 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessageDispatchNotification info = (MessageDispatchNotification) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageIdMarshaller.java
new file mode 100644
index 0000000..376da73
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageIdMarshaller.java
@@ -0,0 +1,135 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.ProducerId;
+
+public class MessageIdMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageId();
+ }
+
+ /**
+ * 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), 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);
+
+ MessageId info = (MessageId) o;
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerSequenceId(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 {
+ MessageId info = (MessageId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageMarshaller.java
new file mode 100644
index 0000000..7bd679d
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessageMarshaller.java
@@ -0,0 +1,304 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.ProducerId;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public abstract class MessageMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setGroupID(tightUnmarshalString(dataIn, bs));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setPersistent(bs.readBoolean());
+ info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setType(tightUnmarshalString(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setCompressed(bs.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setUserId(tightUnmarshalString(dataIn, bs));
+ info.setRecievedByDFBridge(bs.readBoolean());
+ info.setDroppable(bs.readBoolean());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs);
+ rc += tightMarshalString1(info.getGroupId(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ bs.writeBoolean(info.isPersistent());
+ rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
+ rc += tightMarshalString1(info.getType(), bs);
+ rc += tightMarshalByteSequence1(info.getContent(), bs);
+ rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs);
+ bs.writeBoolean(info.isCompressed());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
+ rc += tightMarshalString1(info.getUserId(), bs);
+ bs.writeBoolean(info.isRecievedByDFBridge());
+ bs.writeBoolean(info.isDroppable());
+ rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs);
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ Message info = (Message) o;
+ tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs);
+ tightMarshalString2(info.getGroupId(), dataOut, bs);
+ dataOut.writeInt(info.getGroupSequence());
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
+ dataOut.writeByte(info.getPriority());
+ tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
+ tightMarshalString2(info.getType(), dataOut, bs);
+ tightMarshalByteSequence2(info.getContent(), dataOut, bs);
+ tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ dataOut.writeInt(info.getRedeliveryCounter());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
+ tightMarshalString2(info.getUserId(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs);
+
+ info.afterMarshall(wireFormat);
+ }
+
+ /**
+ * 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);
+
+ Message info = (Message) o;
+
+ info.beforeUnmarshall(wireFormat);
+
+ info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setGroupID(looseUnmarshalString(dataIn));
+ info.setGroupSequence(dataIn.readInt());
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setPersistent(dataIn.readBoolean());
+ info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
+ info.setPriority(dataIn.readByte());
+ info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
+ info.setType(looseUnmarshalString(dataIn));
+ info.setContent(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setCompressed(dataIn.readBoolean());
+ info.setRedeliveryCounter(dataIn.readInt());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
+ info.setUserId(looseUnmarshalString(dataIn));
+ info.setRecievedByDFBridge(dataIn.readBoolean());
+ info.setDroppable(dataIn.readBoolean());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setCluster(value);
+ } else {
+ info.setCluster(null);
+ }
+ info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn));
+ info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn));
+
+ info.afterUnmarshall(wireFormat);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ Message info = (Message) o;
+
+ info.beforeMarshall(wireFormat);
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut);
+ looseMarshalString(info.getGroupId(), dataOut);
+ dataOut.writeInt(info.getGroupSequence());
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ dataOut.writeBoolean(info.isPersistent());
+ looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
+ dataOut.writeByte(info.getPriority());
+ looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
+ looseMarshalString(info.getType(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
+ looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isCompressed());
+ dataOut.writeInt(info.getRedeliveryCounter());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalLong(wireFormat, info.getArrival(), dataOut);
+ looseMarshalString(info.getUserId(), dataOut);
+ dataOut.writeBoolean(info.isRecievedByDFBridge());
+ dataOut.writeBoolean(info.isDroppable());
+ looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut);
+ looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessagePullMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessagePullMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessagePullMarshaller.java
new file mode 100644
index 0000000..41700b2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/MessagePullMarshaller.java
@@ -0,0 +1,146 @@
+/**
+ * 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.v7;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.MessagePull;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class MessagePullMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessagePull.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessagePull();
+ }
+
+ /**
+ * 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setCorrelationId(tightUnmarshalString(dataIn, bs));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalString1(info.getCorrelationId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalString2(info.getCorrelationId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), 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);
+
+ MessagePull info = (MessagePull) o;
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+ info.setCorrelationId(looseUnmarshalString(dataIn));
+ info.setMessageId((MessageId) 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 {
+ MessagePull info = (MessagePull) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalString(info.getCorrelationId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/NetworkBridgeFilterMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/NetworkBridgeFilterMarshaller.java
new file mode 100644
index 0000000..538e538
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/NetworkBridgeFilterMarshaller.java
@@ -0,0 +1 @@
+/**
* 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.v7;
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;
import org.apache.activemq.openwire.commands.NetworkBridgeFilter;
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
@Override
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
@Override
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(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 {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stre
am
* @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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), 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);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId
((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBlobMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBlobMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBlobMessageMarshaller.java
new file mode 100644
index 0000000..7043256
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBlobMessageMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBlobMessage;
+
+public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBlobMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBlobMessage();
+ }
+
+ /**
+ * 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs));
+ info.setMimeType(tightUnmarshalString(dataIn, bs));
+ info.setDeletedByBroker(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getRemoteBlobUrl(), bs);
+ rc += tightMarshalString1(info.getMimeType(), bs);
+ bs.writeBoolean(info.isDeletedByBroker());
+
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs);
+ tightMarshalString2(info.getMimeType(), dataOut, bs);
+ 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);
+
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+ info.setRemoteBlobUrl(looseUnmarshalString(dataIn));
+ info.setMimeType(looseUnmarshalString(dataIn));
+ info.setDeletedByBroker(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireBlobMessage info = (OpenWireBlobMessage) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getRemoteBlobUrl(), dataOut);
+ looseMarshalString(info.getMimeType(), dataOut);
+ dataOut.writeBoolean(info.isDeletedByBroker());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBytesMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBytesMessageMarshaller.java
new file mode 100644
index 0000000..077a815
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireBytesMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireBytesMessage;
+
+public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireBytesMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireBytesMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireDestinationMarshaller.java
new file mode 100644
index 0000000..272e91a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireDestinationMarshaller.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.v7;
+
+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.OpenWireDestination;
+
+public abstract class OpenWireDestinationMarshaller 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(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 {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ tightMarshalString2(info.getPhysicalName(), 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);
+
+ OpenWireDestination info = (OpenWireDestination) o;
+ info.setPhysicalName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ OpenWireDestination info = (OpenWireDestination) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getPhysicalName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMapMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMapMessageMarshaller.java
new file mode 100644
index 0000000..fb2fabd
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMapMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMapMessage;
+
+public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMapMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMapMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMessageMarshaller.java
new file mode 100644
index 0000000..62c68d0
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireMessageMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireMessage;
+
+public class OpenWireMessageMarshaller extends MessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireObjectMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireObjectMessageMarshaller.java
new file mode 100644
index 0000000..2bf8e89
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireObjectMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireObjectMessage;
+
+public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireObjectMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireObjectMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireQueueMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireQueueMarshaller.java
new file mode 100644
index 0000000..5d14f66
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireQueueMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+
+public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireQueue.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireQueue();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireStreamMessageMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireStreamMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireStreamMessageMarshaller.java
new file mode 100644
index 0000000..770c074
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireStreamMessageMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v7;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireStreamMessage;
+
+public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return OpenWireStreamMessage.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new OpenWireStreamMessage();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempDestinationMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempDestinationMarshaller.java
new file mode 100644
index 0000000..f8f82fb
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v7/OpenWireTempDestinationMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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.v7;
+
+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;
+
+public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller {
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
[31/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTestSupport.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTestSupport.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTestSupport.java
new file mode 100644
index 0000000..68fe869
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTestSupport.java
@@ -0,0 +1,265 @@
+/**
+ * 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.IOException;
+import java.net.URI;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.jms.JMSException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.codec.OpenWireFormatFactory;
+import org.apache.activemq.openwire.commands.BrokerInfo;
+import org.apache.activemq.openwire.commands.Command;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.MessageDispatch;
+import org.apache.activemq.openwire.commands.Response;
+import org.apache.activemq.openwire.commands.ShutdownInfo;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+import org.apache.activemq.openwire.util.TcpTransport;
+import org.apache.activemq.openwire.util.TransportListener;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class used in testing the interoperability between the OpenWire
+ * commands and Marshalers in this library and those in ActiveMQ.
+ */
+public abstract class OpenWireInteropTestSupport implements TransportListener {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireInteropTestSupport.class);
+
+ @Rule public TestName name = new TestName();
+
+ protected BrokerService brokerService;
+
+ private TcpTransport transport;
+ protected URI connectionURI;
+
+ private OpenWireFormatFactory factory;
+ protected OpenWireFormat wireFormat;
+
+ private CountDownLatch connected;
+
+ private WireFormatInfo remoteWireformatInfo;
+ private BrokerInfo remoteInfo;
+ private Exception failureCause;
+ private final AtomicInteger requestIdGenerator = new AtomicInteger(1);
+
+ private final Map<Integer, CountDownLatch> requestMap =
+ new ConcurrentHashMap<Integer, CountDownLatch>();
+
+ protected Command latest;
+ protected final Queue<Message> messages = new LinkedList<Message>();
+
+ @Before
+ public void setUp() throws Exception {
+ brokerService = createBroker();
+ brokerService.start();
+ brokerService.waitUntilStarted();
+
+ factory = new OpenWireFormatFactory();
+ factory.setVersion(getOpenWireVersion());
+ factory.setCacheEnabled(false);
+ factory.setTightEncodingEnabled(isTightEncodingEnabled());
+
+ wireFormat = factory.createWireFormat();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ disconnect();
+
+ if (brokerService != null) {
+ brokerService.stop();
+ brokerService.waitUntilStopped();
+ }
+ }
+
+ protected abstract int getOpenWireVersion();
+
+ protected abstract boolean isTightEncodingEnabled();
+
+ protected void connect() throws Exception {
+ connected = new CountDownLatch(1);
+
+ transport = new TcpTransport(wireFormat, connectionURI);
+ transport.setTransportListener(this);
+ transport.start();
+
+ transport.oneway(wireFormat.getPreferedWireFormatInfo());
+ }
+
+ protected void disconnect() throws Exception {
+ if (transport != null && transport.isStarted()) {
+ ShutdownInfo done = new ShutdownInfo();
+ transport.oneway(done);
+ Thread.sleep(50);
+ transport.stop();
+ }
+ }
+
+ protected boolean request(Command command, long timeout, TimeUnit units) throws Exception {
+ command.setCommandId(requestIdGenerator.getAndIncrement());
+ command.setResponseRequired(true);
+ CountDownLatch complete = new CountDownLatch(1);
+ requestMap.put(new Integer(command.getCommandId()), complete);
+ transport.oneway(command);
+ return complete.await(timeout, units);
+ }
+
+ protected boolean awaitConnected(long time, TimeUnit unit) throws InterruptedException {
+ return connected.await(time, unit);
+ }
+
+ protected BrokerService createBroker() throws Exception {
+ BrokerService brokerService = new BrokerService();
+ brokerService.setPersistent(false);
+ brokerService.setAdvisorySupport(false);
+ brokerService.setDeleteAllMessagesOnStartup(true);
+ brokerService.setUseJmx(true);
+
+ TransportConnector connector = brokerService.addConnector("tcp://0.0.0.0:0?transport.trace=true&trace=true");
+ connectionURI = connector.getPublishableConnectURI();
+ LOG.debug("Using openwire port: {}", connectionURI);
+ return brokerService;
+ }
+
+ @Override
+ public void onCommand(Object command) {
+ try {
+ if (command instanceof WireFormatInfo) {
+ handleWireFormatInfo((WireFormatInfo) command);
+ } else if (command instanceof KeepAliveInfo) {
+ handleKeepAliveInfo((KeepAliveInfo) command);
+ } else if (command instanceof BrokerInfo) {
+ handleBrokerInfo((BrokerInfo) command);
+ } else if (command instanceof Response) {
+ Response response = (Response) command;
+ this.latest = response;
+ LOG.info("Received response for request: {}, response = {}", response.getCorrelationId(), latest);
+ CountDownLatch done = requestMap.get(response.getCorrelationId());
+ if (done != null) {
+ done.countDown();
+ }
+ } else if (command instanceof MessageDispatch) {
+ LOG.info("Received new MessageDispatch: {}", command);
+ MessageDispatch dispatch = (MessageDispatch) command;
+ messages.add(dispatch.getMessage());
+ } else {
+ LOG.info("Received unknown command: {}", command);
+ }
+ } catch (Exception e) {
+ failureCause = e;
+ }
+ }
+
+ @Override
+ public void onException(IOException error) {
+ failureCause = error;
+ }
+
+ @Override
+ public void transportInterupted() {
+ }
+
+ @Override
+ public void transportResumed() {
+ }
+
+ public WireFormatInfo getRemoteWireFormatInfo() {
+ return this.remoteWireformatInfo;
+ }
+
+ public BrokerInfo getRemoteBrokerInfo() {
+ return this.remoteInfo;
+ }
+
+ public Command getLastCommandReceived() {
+ return this.latest;
+ }
+
+ public boolean isFailed() {
+ return this.failureCause != null;
+ }
+
+ protected void handleWireFormatInfo(WireFormatInfo info) throws Exception {
+ LOG.info("Received remote WireFormatInfo: {}", info);
+ this.remoteWireformatInfo = info;
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(this + " before negotiation: " + wireFormat);
+ }
+ if (!info.isValid()) {
+ onException(new IOException("Remote wire format magic is invalid"));
+ } else if (info.getVersion() < getOpenWireVersion()) {
+ onException(new IOException("Remote wire format (" + info.getVersion() +
+ ") is lower the minimum version required (" + getOpenWireVersion() + ")"));
+ }
+
+ wireFormat.renegotiateWireFormat(info);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(this + " after negotiation: " + wireFormat);
+ }
+
+ connected.countDown();
+ }
+
+ protected void handleKeepAliveInfo(KeepAliveInfo info) throws Exception {
+ LOG.info("Received remote KeepAliveInfo: {}", info);
+ if (info.isResponseRequired()) {
+ KeepAliveInfo response = new KeepAliveInfo();
+ transport.oneway(response);
+ }
+ }
+
+ protected void handleBrokerInfo(BrokerInfo info) throws Exception {
+ LOG.info("Received remote BrokerInfo: {}", info);
+ this.remoteInfo = info;
+ }
+
+ protected QueueViewMBean getProxyToQueue(String name) throws MalformedObjectNameException, JMSException {
+ ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName="+name);
+ QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext()
+ .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
+ return proxy;
+ }
+
+ protected QueueViewMBean getProxyToTopic(String name) throws MalformedObjectNameException, JMSException {
+ ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Topic,destinationName="+name);
+ QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext()
+ .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
+ return proxy;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTests.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTests.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTests.java
new file mode 100644
index 0000000..f4e2951
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/OpenWireInteropTests.java
@@ -0,0 +1,241 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.openwire.commands.ConnectionInfo;
+import org.apache.activemq.openwire.commands.ConsumerInfo;
+import org.apache.activemq.openwire.commands.Message;
+import org.apache.activemq.openwire.commands.OpenWireQueue;
+import org.apache.activemq.openwire.commands.OpenWireTextMessage;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+import org.apache.activemq.openwire.commands.ProducerInfo;
+import org.apache.activemq.openwire.util.Wait;
+import org.apache.activemq.openwire.utils.OpenWireConnection;
+import org.apache.activemq.openwire.utils.OpenWireConsumer;
+import org.apache.activemq.openwire.utils.OpenWireProducer;
+import org.apache.activemq.openwire.utils.OpenWireSession;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@RunWith(Parameterized.class)
+public abstract class OpenWireInteropTests extends OpenWireInteropTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireInteropTests.class);
+
+ protected OpenWireConnection connectionId;
+ protected boolean tightEncodingEnabled;
+
+ public OpenWireInteropTests(boolean tightEncodingEnabled) {
+ this.tightEncodingEnabled = tightEncodingEnabled;
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][] { { Boolean.FALSE }, { Boolean.TRUE } });
+ }
+
+ @Override
+ protected boolean isTightEncodingEnabled() {
+ return tightEncodingEnabled;
+ }
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ connectionId = new OpenWireConnection();
+ }
+
+ @Test(timeout = 60000)
+ public void testCanConnect() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertEquals(getOpenWireVersion(), getRemoteWireFormatInfo().getVersion());
+
+ if (isTightEncodingEnabled()) {
+ LOG.info("Should be using tight encoding: are we? {}", wireFormat.isTightEncodingEnabled());
+ assertTrue(wireFormat.isTightEncodingEnabled());
+ } else {
+ LOG.info("Should not be using tight encoding: are we? {}", wireFormat.isTightEncodingEnabled());
+ assertFalse(wireFormat.isTightEncodingEnabled());
+ }
+ }
+
+ @Test(timeout = 60000)
+ public void testCreateConnection() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertTrue(request(createConnectionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+ }
+
+ @Test(timeout = 60000)
+ public void testCreateSession() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertTrue(request(createConnectionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+ OpenWireSession sessionId = connectionId.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ }
+
+ @Test(timeout = 60000)
+ public void testCreateProducer() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertTrue(request(createConnectionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connectionId.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ OpenWireProducer producerId = sessionId.createOpenWireProducer();
+
+ ProducerInfo info = producerId.createProducerInfo(new OpenWireTopic(name.getMethodName() + "-Topic"));
+ info.setDispatchAsync(false);
+ assertTrue(request(info, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getTopicProducers().length);
+
+ assertTrue(request(producerId.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getTopicProducers().length);
+ }
+
+ @Test(timeout = 60000)
+ public void testCreateConsumer() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertTrue(request(createConnectionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connectionId.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ OpenWireConsumer consumerId = sessionId.createOpenWireConsumer();
+
+ ConsumerInfo info = consumerId.createConsumerInfo(new OpenWireTopic(name.getMethodName() + "-Topic"));
+ info.setDispatchAsync(false);
+ assertTrue(request(info, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getTopicSubscribers().length);
+
+ assertTrue(request(consumerId.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getTopicSubscribers().length);
+ }
+
+ @Test(timeout = 60000)
+ public void testSendMessageToQueue() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertTrue(request(createConnectionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connectionId.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ OpenWireProducer producerId = sessionId.createOpenWireProducer();
+
+ OpenWireQueue queue = new OpenWireQueue(name.getMethodName() + "-Queue");
+
+ ProducerInfo info = producerId.createProducerInfo(queue);
+ info.setDispatchAsync(false);
+ assertTrue(request(info, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueProducers().length);
+
+ OpenWireTextMessage message = new OpenWireTextMessage();
+ message.setText("test");
+ message.setTimestamp(System.currentTimeMillis());
+ message.setMessageId(producerId.getNextMessageId());
+ message.setProducerId(producerId.getProducerId());
+ message.setDestination(queue);
+ message.onSend();
+
+ assertTrue(request(message, 10, TimeUnit.SECONDS));
+ assertEquals(1, getProxyToQueue(queue.getPhysicalName()).getQueueSize());
+
+ assertTrue(request(producerId.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getQueueProducers().length);
+ }
+
+ @Test(timeout = 60000)
+ public void testConsumeMessageFromQueue() throws Exception {
+ connect();
+ assertTrue(awaitConnected(10, TimeUnit.SECONDS));
+ assertTrue(request(createConnectionInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getCurrentConnectionsCount());
+
+ OpenWireSession sessionId = connectionId.createOpenWireSession();
+ assertTrue(request(sessionId.createSessionInfo(), 10, TimeUnit.SECONDS));
+ OpenWireProducer producerId = sessionId.createOpenWireProducer();
+
+ OpenWireQueue queue = new OpenWireQueue(name.getMethodName() + "-Queue");
+
+ ProducerInfo producerInfo = producerId.createProducerInfo(queue);
+ producerInfo.setDispatchAsync(false);
+ assertTrue(request(producerInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueProducers().length);
+
+ OpenWireTextMessage message = new OpenWireTextMessage();
+ message.setText("test");
+ message.setTimestamp(System.currentTimeMillis());
+ message.setMessageId(producerId.getNextMessageId());
+ message.setProducerId(producerId.getProducerId());
+ message.setDestination(queue);
+ message.onSend();
+
+ assertTrue(request(message, 10, TimeUnit.SECONDS));
+ assertEquals(1, getProxyToQueue(queue.getPhysicalName()).getQueueSize());
+
+ OpenWireConsumer consumerId = sessionId.createOpenWireConsumer();
+ ConsumerInfo consumerInfo = consumerId.createConsumerInfo(queue);
+ consumerInfo.setDispatchAsync(false);
+ consumerInfo.setPrefetchSize(1);
+ assertTrue(request(consumerInfo, 10, TimeUnit.SECONDS));
+ assertEquals(1, brokerService.getAdminView().getQueueSubscribers().length);
+
+ assertTrue("Should have received a message", Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ return messages.size() == 1;
+ }
+ }));
+
+ Message incoming = messages.poll();
+ assertTrue(incoming instanceof OpenWireTextMessage);
+ OpenWireTextMessage received = (OpenWireTextMessage) incoming;
+ assertEquals("test", received.getText());
+
+ assertTrue(request(consumerId.createRemoveInfo(), 10, TimeUnit.SECONDS));
+ assertEquals(0, brokerService.getAdminView().getQueueSubscribers().length);
+ }
+
+ protected ConnectionInfo createConnectionInfo() {
+ ConnectionInfo info = new ConnectionInfo(connectionId.getConnectionId());
+ info.setManageable(false);
+ info.setFaultTolerant(false);
+ info.setClientId(name.getMethodName());
+ return info;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/WireFormatInfoMarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/WireFormatInfoMarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/WireFormatInfoMarshaledSizeTest.java
new file mode 100644
index 0000000..fed1abd
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/WireFormatInfoMarshaledSizeTest.java
@@ -0,0 +1,215 @@
+/**
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.codec.OpenWireFormatFactory;
+import org.apache.activemq.openwire.commands.WireFormatInfo;
+import org.apache.activemq.util.ByteSequence;
+import org.fusesource.hawtbuf.Buffer;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test that the WireFormatInfo marshals and un-marshals correctly.
+ */
+public abstract class WireFormatInfoMarshaledSizeTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(WireFormatInfoMarshaledSizeTest.class);
+
+ private OpenWireFormat wireFormat;
+
+ public int getExpectedMarshaledSize() {
+ return 244;
+ }
+
+ public abstract int getVersion();
+
+ @Before
+ public void setUp() throws Exception {
+ OpenWireFormatFactory factory = new OpenWireFormatFactory();
+ factory.setVersion(getVersion());
+
+ wireFormat = factory.createWireFormat();
+ }
+
+ @Test
+ public void testMarshalledSize1() throws Exception {
+ WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+
+ Buffer result = wireFormat.marshal(info);
+ assertNotNull(result);
+ LOG.info("Size of marshalled object: {}", result.getLength());
+ assertEquals(getExpectedMarshaledSize(), result.getLength());
+
+ ByteArrayInputStream bytesIn = new ByteArrayInputStream(result.toByteArray());
+ DataInputStream input = new DataInputStream(bytesIn);
+
+ int size = input.readInt();
+ assertEquals(getExpectedMarshaledSize() - 4, size);
+ }
+
+ @Test
+ public void testMarshalledSize2() throws Exception {
+ WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(bytesOut);
+
+ wireFormat.marshal(info, dataOut);
+ dataOut.close();
+ ByteSequence result = new ByteSequence(bytesOut.toByteArray());
+
+ LOG.info("Size of marshalled object: {}", result.getLength());
+ assertEquals(getExpectedMarshaledSize(), result.getLength());
+
+ ByteArrayInputStream bytesIn = new ByteArrayInputStream(result.data);
+ DataInputStream input = new DataInputStream(bytesIn);
+
+ int size = input.readInt();
+ assertEquals(getExpectedMarshaledSize() - 4, size);
+ }
+
+ @Test
+ public void testMarshalThenUnmarshal1() throws Exception {
+ final WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+ LOG.info("Original: {}", info);
+
+ Buffer marshaledForm = wireFormat.marshal(info);
+ assertNotNull(marshaledForm);
+
+ Object result = wireFormat.unmarshal(marshaledForm);
+ assertNotNull(result);
+ assertTrue(result instanceof WireFormatInfo);
+ WireFormatInfo duplicate = (WireFormatInfo) result;
+ LOG.info("Duplicated: {}", duplicate);
+
+ assertEquals(info.getVersion(), duplicate.getVersion());
+ assertEquals(info.getCacheSize(), duplicate.getCacheSize());
+ assertEquals(info.getMaxFrameSize(), duplicate.getMaxFrameSize());
+ assertEquals(info.getMaxInactivityDuration(), duplicate.getMaxInactivityDuration());
+ assertEquals(info.getMaxInactivityDurationInitalDelay(), duplicate.getMaxInactivityDurationInitalDelay());
+ assertEquals(info.isCacheEnabled(), duplicate.isCacheEnabled());
+ assertEquals(info.isSizePrefixDisabled(), duplicate.isSizePrefixDisabled());
+ assertEquals(info.isTcpNoDelayEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isStackTraceEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isTightEncodingEnabled(), duplicate.isTightEncodingEnabled());
+ }
+
+ @Test
+ public void testMarshalThenUnmarshal2() throws Exception {
+ final WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+ LOG.info("Original: {}", info);
+
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(bytesOut);
+
+ wireFormat.marshal(info, dataOut);
+ dataOut.close();
+
+ ByteArrayInputStream bytesIn = new ByteArrayInputStream(bytesOut.toByteArray());
+ DataInputStream dataIn = new DataInputStream(bytesIn);
+
+ Object result = wireFormat.unmarshal(dataIn);
+ assertNotNull(result);
+ assertTrue(result instanceof WireFormatInfo);
+ WireFormatInfo duplicate = (WireFormatInfo) result;
+ LOG.info("Duplicated: {}", duplicate);
+
+ assertEquals(info.getVersion(), duplicate.getVersion());
+ assertEquals(info.getCacheSize(), duplicate.getCacheSize());
+ assertEquals(info.getMaxFrameSize(), duplicate.getMaxFrameSize());
+ assertEquals(info.getMaxInactivityDuration(), duplicate.getMaxInactivityDuration());
+ assertEquals(info.getMaxInactivityDurationInitalDelay(), duplicate.getMaxInactivityDurationInitalDelay());
+ assertEquals(info.isCacheEnabled(), duplicate.isCacheEnabled());
+ assertEquals(info.isSizePrefixDisabled(), duplicate.isSizePrefixDisabled());
+ assertEquals(info.isTcpNoDelayEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isStackTraceEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isTightEncodingEnabled(), duplicate.isTightEncodingEnabled());
+ }
+
+ @Test
+ public void testMarshalThenUnmarshal3() throws Exception {
+ final WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+ LOG.info("Original: {}", info);
+
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(bytesOut);
+
+ wireFormat.marshal(info, dataOut);
+ dataOut.close();
+
+ Buffer marshaledForm = new Buffer(bytesOut.toByteArray());
+
+ Object result = wireFormat.unmarshal(marshaledForm);
+ assertNotNull(result);
+ assertTrue(result instanceof WireFormatInfo);
+ WireFormatInfo duplicate = (WireFormatInfo) result;
+ LOG.info("Duplicated: {}", duplicate);
+
+ assertEquals(info.getVersion(), duplicate.getVersion());
+ assertEquals(info.getCacheSize(), duplicate.getCacheSize());
+ assertEquals(info.getMaxFrameSize(), duplicate.getMaxFrameSize());
+ assertEquals(info.getMaxInactivityDuration(), duplicate.getMaxInactivityDuration());
+ assertEquals(info.getMaxInactivityDurationInitalDelay(), duplicate.getMaxInactivityDurationInitalDelay());
+ assertEquals(info.isCacheEnabled(), duplicate.isCacheEnabled());
+ assertEquals(info.isSizePrefixDisabled(), duplicate.isSizePrefixDisabled());
+ assertEquals(info.isTcpNoDelayEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isStackTraceEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isTightEncodingEnabled(), duplicate.isTightEncodingEnabled());
+ }
+
+ @Test
+ public void testMarshalThenUnmarshal4() throws Exception {
+ final WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+ LOG.info("Original: {}", info);
+
+ Buffer marshaledForm = wireFormat.marshal(info);
+ assertNotNull(marshaledForm);
+
+ ByteArrayInputStream bytesIn = new ByteArrayInputStream(marshaledForm.data);
+ DataInputStream dataIn = new DataInputStream(bytesIn);
+
+ Object result = wireFormat.unmarshal(dataIn);
+ assertNotNull(result);
+ assertTrue(result instanceof WireFormatInfo);
+ WireFormatInfo duplicate = (WireFormatInfo) result;
+ LOG.info("Duplicated: {}", duplicate);
+
+ assertEquals(info.getVersion(), duplicate.getVersion());
+ assertEquals(info.getCacheSize(), duplicate.getCacheSize());
+ assertEquals(info.getMaxFrameSize(), duplicate.getMaxFrameSize());
+ assertEquals(info.getMaxInactivityDuration(), duplicate.getMaxInactivityDuration());
+ assertEquals(info.getMaxInactivityDurationInitalDelay(), duplicate.getMaxInactivityDurationInitalDelay());
+ assertEquals(info.isCacheEnabled(), duplicate.isCacheEnabled());
+ assertEquals(info.isSizePrefixDisabled(), duplicate.isSizePrefixDisabled());
+ assertEquals(info.isTcpNoDelayEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isStackTraceEnabled(), duplicate.isTcpNoDelayEnabled());
+ assertEquals(info.isTightEncodingEnabled(), duplicate.isTightEncodingEnabled());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/OpenWireV1Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/OpenWireV1Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/OpenWireV1Test.java
new file mode 100644
index 0000000..c185561
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/OpenWireV1Test.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.activemq.openwire.codec.v1;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV1Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV1Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 1;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoV1MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoV1MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoV1MarshaledSizeTest.java
new file mode 100644
index 0000000..40af674
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v1/WireFormatInfoV1MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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 org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV1MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 1;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/OpenWireV10Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/OpenWireV10Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/OpenWireV10Test.java
new file mode 100644
index 0000000..5f2eb19
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/OpenWireV10Test.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.activemq.openwire.codec.v10;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV10Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV10Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 10;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoV10MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoV10MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoV10MarshaledSizeTest.java
new file mode 100644
index 0000000..54d65bd
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoV10MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v10;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV10MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 10;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/OpenWireV2Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/OpenWireV2Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/OpenWireV2Test.java
new file mode 100644
index 0000000..14e1fae
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/OpenWireV2Test.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.activemq.openwire.codec.v2;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV2Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV2Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoV2MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoV2MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoV2MarshaledSizeTest.java
new file mode 100644
index 0000000..1c19533
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v2/WireFormatInfoV2MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v2;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV2MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/OpenWireV3Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/OpenWireV3Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/OpenWireV3Test.java
new file mode 100644
index 0000000..de32688
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/OpenWireV3Test.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.activemq.openwire.codec.v3;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV3Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV3Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 3;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoV3MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoV3MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoV3MarshaledSizeTest.java
new file mode 100644
index 0000000..68978fe
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v3/WireFormatInfoV3MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v3;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV3MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 3;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/OpenWireV4Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/OpenWireV4Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/OpenWireV4Test.java
new file mode 100644
index 0000000..6cde172
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/OpenWireV4Test.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.activemq.openwire.codec.v4;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV4Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV4Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 4;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoV4MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoV4MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoV4MarshaledSizeTest.java
new file mode 100644
index 0000000..e448935
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v4/WireFormatInfoV4MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v4;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV4MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 4;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/OpenWireV5Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/OpenWireV5Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/OpenWireV5Test.java
new file mode 100644
index 0000000..3331c5b
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/OpenWireV5Test.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.activemq.openwire.codec.v5;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV5Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV5Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 5;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoV5MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoV5MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoV5MarshaledSizeTest.java
new file mode 100644
index 0000000..63303ad
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v5/WireFormatInfoV5MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v5;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV5MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 5;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/OpenWireV6Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/OpenWireV6Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/OpenWireV6Test.java
new file mode 100644
index 0000000..d33a5b8
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/OpenWireV6Test.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.activemq.openwire.codec.v6;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV6Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV6Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 6;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoV6MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoV6MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoV6MarshaledSizeTest.java
new file mode 100644
index 0000000..fca4250
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v6/WireFormatInfoV6MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v6;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV6MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 6;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/OpenWireV7Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/OpenWireV7Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/OpenWireV7Test.java
new file mode 100644
index 0000000..3cdabda
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/OpenWireV7Test.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.activemq.openwire.codec.v7;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV7Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV7Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 7;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoV7MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoV7MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoV7MarshaledSizeTest.java
new file mode 100644
index 0000000..b28bf48
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v7/WireFormatInfoV7MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v7;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV7MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 7;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/OpenWireV8Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/OpenWireV8Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/OpenWireV8Test.java
new file mode 100644
index 0000000..acb8930
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/OpenWireV8Test.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.activemq.openwire.codec.v8;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV8Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV8Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 8;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/WireFormatInfoV8MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/WireFormatInfoV8MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/WireFormatInfoV8MarshaledSizeTest.java
new file mode 100644
index 0000000..2e1b816
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v8/WireFormatInfoV8MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v8;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV8MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 8;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/OpenWireV9Test.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/OpenWireV9Test.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/OpenWireV9Test.java
new file mode 100644
index 0000000..b91c699
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/OpenWireV9Test.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.activemq.openwire.codec.v9;
+
+import org.apache.activemq.openwire.codec.OpenWireInteropTests;
+
+public class OpenWireV9Test extends OpenWireInteropTests {
+
+ /**
+ * @param tightEncodingEnabled
+ */
+ public OpenWireV9Test(boolean tightEncodingEnabled) {
+ super(tightEncodingEnabled);
+ }
+
+ @Override
+ protected int getOpenWireVersion() {
+ return 9;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoV9MarshaledSizeTest.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoV9MarshaledSizeTest.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoV9MarshaledSizeTest.java
new file mode 100644
index 0000000..6bea3a8
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoV9MarshaledSizeTest.java
@@ -0,0 +1,30 @@
+/**
+ * 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.v9;
+
+import org.apache.activemq.openwire.codec.WireFormatInfoMarshaledSizeTest;
+
+/**
+ * Test marshaling with WireFormatInfo for this Version.
+ */
+public class WireFormatInfoV9MarshaledSizeTest extends WireFormatInfoMarshaledSizeTest {
+
+ @Override
+ public int getVersion() {
+ return 9;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TcpTransport.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TcpTransport.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TcpTransport.java
new file mode 100644
index 0000000..48ba3d1
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TcpTransport.java
@@ -0,0 +1,414 @@
+/**
+gxfdgvdfg * 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.util;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.net.URI;
+import java.net.UnknownHostException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.net.SocketFactory;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.transport.tcp.TcpBufferedInputStream;
+import org.apache.activemq.transport.tcp.TcpBufferedOutputStream;
+import org.apache.activemq.util.ServiceStopper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ */
+public class TcpTransport implements Runnable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(TcpTransport.class);
+
+ protected final URI remoteLocation;
+ protected final OpenWireFormat wireFormat;
+
+ protected int connectionTimeout = 30000;
+ protected int socketBufferSize = 64 * 1024;
+ protected int ioBufferSize = 8 * 1024;
+ protected Socket socket;
+ protected DataOutputStream dataOut;
+ protected DataInputStream dataIn;
+
+ protected int minmumWireFormatVersion;
+ protected SocketFactory socketFactory;
+ protected final AtomicReference<CountDownLatch> stoppedLatch = new AtomicReference<CountDownLatch>();
+ protected volatile int receiveCounter;
+
+ private Thread runnerThread;
+ private AtomicBoolean started = new AtomicBoolean(false);
+ private AtomicBoolean stopping = new AtomicBoolean(false);
+ private AtomicBoolean stopped = new AtomicBoolean(false);
+ private TransportListener transportListener;
+
+ /**
+ * Connect to a remote Node - e.g. a Broker
+ *
+ * @param wireFormat
+ * @param socketFactory
+ * @param remoteLocation
+ * @param localLocation
+ * - e.g. local InetAddress and local port
+ * @throws IOException
+ * @throws UnknownHostException
+ */
+ public TcpTransport(OpenWireFormat wireFormat, URI remoteLocation) throws UnknownHostException, IOException {
+ this.wireFormat = wireFormat;
+ this.socketFactory = SocketFactory.getDefault();
+ try {
+ this.socket = socketFactory.createSocket();
+ } catch (SocketException e) {
+ this.socket = null;
+ }
+ this.remoteLocation = remoteLocation;
+ }
+
+ /**
+ * A one way asynchronous send
+ */
+ public void oneway(Object command) throws IOException {
+ checkStarted();
+ wireFormat.marshal(command, dataOut);
+ dataOut.flush();
+ }
+
+ /**
+ * reads packets from a Socket
+ */
+ public void run() {
+ LOG.trace("TCP consumer thread for {} starting", this);
+ this.runnerThread = Thread.currentThread();
+ try {
+ while (!isStopped()) {
+ doRun();
+ }
+ } catch (IOException e) {
+ stoppedLatch.get().countDown();
+ onException(e);
+ } catch (Throwable e) {
+ stoppedLatch.get().countDown();
+ IOException ioe = new IOException("Unexpected error occured: " + e);
+ ioe.initCause(e);
+ onException(ioe);
+ } finally {
+ stoppedLatch.get().countDown();
+ }
+ }
+
+ protected void doRun() throws IOException {
+ try {
+ Object command = readCommand();
+ doConsume(command);
+ } catch (SocketTimeoutException e) {
+ } catch (InterruptedIOException e) {
+ }
+ }
+
+ protected Object readCommand() throws IOException {
+ return wireFormat.unmarshal(dataIn);
+ }
+
+ /**
+ * Configures the socket for use
+ *
+ * @param sock
+ * the socket
+ * @throws SocketException
+ * , IllegalArgumentException if setting the options on the socket
+ * failed.
+ */
+ protected void initialiseSocket(Socket sock) throws SocketException, IllegalArgumentException {
+ try {
+ sock.setReceiveBufferSize(socketBufferSize);
+ sock.setSendBufferSize(socketBufferSize);
+ } catch (SocketException se) {
+ LOG.warn("Cannot set socket buffer size = {}", socketBufferSize);
+ LOG.debug("Cannot set socket buffer size. Reason: {}. This exception is ignored.",
+ se.getMessage(), se);
+ }
+ }
+
+ public void start() throws Exception {
+ if (started.compareAndSet(false, true)) {
+ boolean success = false;
+ stopped.set(false);
+ try {
+ doStart();
+ success = true;
+ } finally {
+ started.set(success);
+ }
+ }
+ }
+
+ public void stop() throws Exception {
+ if (stopped.compareAndSet(false, true)) {
+ stopping.set(true);
+ ServiceStopper stopper = new ServiceStopper();
+ try {
+ doStop(stopper);
+ } catch (Exception e) {
+ stopper.onException(this, e);
+ }
+ stopped.set(true);
+ started.set(false);
+ stopping.set(false);
+ stopper.throwFirstException();
+ }
+
+ CountDownLatch countDownLatch = stoppedLatch.get();
+ if (countDownLatch != null && Thread.currentThread() != this.runnerThread) {
+ countDownLatch.await(1, TimeUnit.SECONDS);
+ }
+ }
+
+ protected void doStart() throws Exception {
+ connect();
+ stoppedLatch.set(new CountDownLatch(1));
+
+ runnerThread = new Thread(null, this, "OpenWire Test Transport: " + toString());
+ runnerThread.setDaemon(false);
+ runnerThread.start();
+ }
+
+ protected void connect() throws Exception {
+ if (socket == null && socketFactory == null) {
+ throw new IllegalStateException("Cannot connect if the socket or socketFactory have not been set");
+ }
+
+ InetSocketAddress remoteAddress = null;
+
+ if (remoteLocation != null) {
+ remoteAddress = new InetSocketAddress(remoteLocation.getHost(), remoteLocation.getPort());
+ }
+
+ socket = socketFactory.createSocket(remoteAddress.getAddress(), remoteAddress.getPort());
+
+ initialiseSocket(socket);
+ initializeStreams();
+ }
+
+ protected void doStop(ServiceStopper stopper) throws Exception {
+ LOG.debug("Stopping transport {}", this);
+
+ if (socket != null) {
+ LOG.trace("Closing socket {}", socket);
+ try {
+ socket.close();
+ LOG.debug("Closed socket {}", socket);
+ } catch (IOException e) {
+ LOG.debug("Caught exception closing socket {}. This exception will be ignored.", socket, e);
+ }
+ }
+ }
+
+ protected void initializeStreams() throws Exception {
+ TcpBufferedInputStream buffIn = new TcpBufferedInputStream(socket.getInputStream(), ioBufferSize) {
+ @Override
+ public int read() throws IOException {
+ receiveCounter++;
+ return super.read();
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ receiveCounter++;
+ return super.read(b, off, len);
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ receiveCounter++;
+ return super.skip(n);
+ }
+
+ @Override
+ protected void fill() throws IOException {
+ receiveCounter++;
+ super.fill();
+ }
+ };
+ this.dataIn = new DataInputStream(buffIn);
+ TcpBufferedOutputStream outputStream = new TcpBufferedOutputStream(socket.getOutputStream(), ioBufferSize);
+ this.dataOut = new DataOutputStream(outputStream);
+ }
+
+ protected void closeStreams() throws IOException {
+ if (dataOut != null) {
+ dataOut.close();
+ }
+ if (dataIn != null) {
+ dataIn.close();
+ }
+ }
+
+ /**
+ * Process the inbound command
+ */
+ public void doConsume(Object command) {
+ if (command != null) {
+ if (transportListener != null) {
+ transportListener.onCommand(command);
+ } else {
+ LOG.error("No transportListener available to process inbound command: {}", command);
+ }
+ }
+ }
+
+ /**
+ * Passes any IO exceptions into the transport listener
+ */
+ public void onException(IOException e) {
+ if (transportListener != null) {
+ try {
+ transportListener.onException(e);
+ } catch (RuntimeException e2) {
+ // Handle any unexpected runtime exceptions by debug logging them.
+ LOG.debug("Unexpected runtime exception: " + e2, e2);
+ }
+ }
+ }
+
+ public String getRemoteAddress() {
+ if (socket != null) {
+ SocketAddress address = socket.getRemoteSocketAddress();
+ if (address instanceof InetSocketAddress) {
+ return "tcp://" + ((InetSocketAddress) address).getAddress().getHostAddress() + ":" + ((InetSocketAddress) address).getPort();
+ } else {
+ return "" + socket.getRemoteSocketAddress();
+ }
+ }
+ return null;
+ }
+
+ public int getReceiveCounter() {
+ return receiveCounter;
+ }
+
+ public OpenWireFormat getWireFormat() {
+ return wireFormat;
+ }
+
+ /**
+ * @return true if this service has been started
+ */
+ public boolean isStarted() {
+ return started.get();
+ }
+
+ /**
+ * @return true if this service is in the process of closing
+ */
+ public boolean isStopping() {
+ return stopping.get();
+ }
+
+ /**
+ * @return true if this service is closed
+ */
+ public boolean isStopped() {
+ return stopped.get();
+ }
+
+ /**
+ * Returns the current transport listener
+ */
+ public TransportListener getTransportListener() {
+ return transportListener;
+ }
+
+ /**
+ * Registers an inbound command listener
+ *
+ * @param commandListener
+ */
+ public void setTransportListener(TransportListener commandListener) {
+ this.transportListener = commandListener;
+ }
+
+ public int getMinmumWireFormatVersion() {
+ return minmumWireFormatVersion;
+ }
+
+ public void setMinmumWireFormatVersion(int minmumWireFormatVersion) {
+ this.minmumWireFormatVersion = minmumWireFormatVersion;
+ }
+
+ public int getSocketBufferSize() {
+ return socketBufferSize;
+ }
+
+ /**
+ * Sets the buffer size to use on the socket
+ */
+ public void setSocketBufferSize(int socketBufferSize) {
+ this.socketBufferSize = socketBufferSize;
+ }
+
+ public int getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ /**
+ * Sets the timeout used to connect to the socket
+ */
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ /**
+ * @return the ioBufferSize
+ */
+ public int getIoBufferSize() {
+ return this.ioBufferSize;
+ }
+
+ /**
+ * @param ioBufferSize
+ * the ioBufferSize to set
+ */
+ public void setIoBufferSize(int ioBufferSize) {
+ this.ioBufferSize = ioBufferSize;
+ }
+
+ /**
+ * @return pretty print of 'this'
+ */
+ @Override
+ public String toString() {
+ return "" + (socket.isConnected() ? "tcp://" + socket.getInetAddress() + ":" + socket.getPort() + "@" + socket.getLocalPort() : remoteLocation);
+ }
+
+ protected void checkStarted() throws IOException {
+ if (!isStarted()) {
+ throw new IOException("The transport is not running.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TransportListener.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TransportListener.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TransportListener.java
new file mode 100644
index 0000000..81c886b
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/TransportListener.java
@@ -0,0 +1,52 @@
+/**
+ * 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.util;
+
+import java.io.IOException;
+
+/**
+ * An asynchronous listener of commands
+ */
+public interface TransportListener {
+
+ /**
+ * called to process a command
+ *
+ * @param command
+ */
+ void onCommand(Object command);
+
+ /**
+ * An unrecoverable exception has occurred on the transport
+ *
+ * @param error
+ */
+ void onException(IOException error);
+
+ /**
+ * The transport has suffered an interruption from which it hopes to recover
+ *
+ */
+ void transportInterupted();
+
+ /**
+ * The transport has resumed after an interruption
+ *
+ */
+ void transportResumed();
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/Wait.java
----------------------------------------------------------------------
diff --git a/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/Wait.java b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/Wait.java
new file mode 100644
index 0000000..2bc1e61
--- /dev/null
+++ b/openwire-interop-tests/src/test/java/org/apache/activemq/openwire/util/Wait.java
@@ -0,0 +1,48 @@
+/**
+ * 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.util;
+
+import java.util.concurrent.TimeUnit;
+
+public class Wait {
+
+ public static final long MAX_WAIT_MILLIS = 30 * 1000;
+ public static final int SLEEP_MILLIS = 1000;
+
+ public interface Condition {
+ boolean isSatisified() throws Exception;
+ }
+
+ public static boolean waitFor(Condition condition) throws Exception {
+ return waitFor(condition, MAX_WAIT_MILLIS);
+ }
+
+ public static boolean waitFor(final Condition condition, final long duration) throws Exception {
+ return waitFor(condition, duration, SLEEP_MILLIS);
+ }
+
+ public static boolean waitFor(final Condition condition, final long duration, final int sleepMillis) throws Exception {
+
+ final long expiry = System.currentTimeMillis() + duration;
+ boolean conditionSatisified = condition.isSatisified();
+ while (!conditionSatisified && System.currentTimeMillis() < expiry) {
+ TimeUnit.MILLISECONDS.sleep(sleepMillis);
+ conditionSatisified = condition.isSatisified();
+ }
+ return conditionSatisified;
+ }
+}
[28/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessageTest.java b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessageTest.java
new file mode 100644
index 0000000..9313a5e
--- /dev/null
+++ b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMapMessageTest.java
@@ -0,0 +1,488 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.jms.JMSException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.jms.OpenWireJMSMapMessage;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test the OpenWireJMSMapMessage facade class.
+ */
+public class OpenWireJMSMapMessageTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireJMSMapMessageTest.class);
+
+ private final String name = "testName";
+
+ @Test
+ public void testBytesConversion() throws JMSException, IOException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ msg.setBoolean("boolean", true);
+ msg.setByte("byte", (byte)1);
+ msg.setBytes("bytes", new byte[1]);
+ msg.setChar("char", 'a');
+ msg.setDouble("double", 1.5);
+ msg.setFloat("float", 1.5f);
+ msg.setInt("int", 1);
+ msg.setLong("long", 1);
+ msg.setObject("object", "stringObj");
+ msg.setShort("short", (short)1);
+ msg.setString("string", "string");
+
+ // Test with a 1Meg String
+ StringBuffer bigSB = new StringBuffer(1024 * 1024);
+ for (int i = 0; i < 1024 * 1024; i++) {
+ bigSB.append('a' + i % 26);
+ }
+ String bigString = bigSB.toString();
+
+ msg.setString("bigString", bigString);
+
+ msg = msg.copy();
+
+ assertEquals(msg.getBoolean("boolean"), true);
+ assertEquals(msg.getByte("byte"), (byte)1);
+ assertEquals(msg.getBytes("bytes").length, 1);
+ assertEquals(msg.getChar("char"), 'a');
+ assertEquals(msg.getDouble("double"), 1.5, 0);
+ assertEquals(msg.getFloat("float"), 1.5f, 0);
+ assertEquals(msg.getInt("int"), 1);
+ assertEquals(msg.getLong("long"), 1);
+ assertEquals(msg.getObject("object"), "stringObj");
+ assertEquals(msg.getShort("short"), (short)1);
+ assertEquals(msg.getString("string"), "string");
+ assertEquals(msg.getString("bigString"), bigString);
+ }
+
+ @Test
+ public void testGetBoolean() throws JMSException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ msg.setBoolean(name, true);
+ msg.setReadOnlyBody(true);
+ assertTrue(msg.getBoolean(name));
+ msg.clearBody();
+ msg.setString(name, "true");
+
+ msg = msg.copy();
+
+ assertTrue(msg.getBoolean(name));
+ }
+
+ @Test
+ public void testGetByte() throws JMSException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ msg.setByte(this.name, (byte)1);
+ msg = msg.copy();
+ assertTrue(msg.getByte(this.name) == (byte)1);
+ }
+
+ @Test
+ public void testGetShort() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ msg.setShort(this.name, (short)1);
+ msg = msg.copy();
+ assertTrue(msg.getShort(this.name) == (short)1);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetChar() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ msg.setChar(this.name, 'a');
+ msg = msg.copy();
+ assertTrue(msg.getChar(this.name) == 'a');
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetInt() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ msg.setInt(this.name, 1);
+ msg = msg.copy();
+ assertTrue(msg.getInt(this.name) == 1);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetLong() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ msg.setLong(this.name, 1);
+ msg = msg.copy();
+ assertTrue(msg.getLong(this.name) == 1);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetFloat() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ msg.setFloat(this.name, 1.5f);
+ msg = msg.copy();
+ assertTrue(msg.getFloat(this.name) == 1.5f);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetDouble() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ msg.setDouble(this.name, 1.5);
+ msg = msg.copy();
+ assertTrue(msg.getDouble(this.name) == 1.5);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetString() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ String str = "test";
+ msg.setString(this.name, str);
+ msg = msg.copy();
+ assertEquals(msg.getString(this.name), str);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetBytes() {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ try {
+ byte[] bytes1 = new byte[3];
+ byte[] bytes2 = new byte[2];
+ System.arraycopy(bytes1, 0, bytes2, 0, 2);
+ msg.setBytes(this.name, bytes1);
+ msg.setBytes(this.name + "2", bytes1, 0, 2);
+ msg = msg.copy();
+ assertTrue(Arrays.equals(msg.getBytes(this.name), bytes1));
+ assertEquals(msg.getBytes(this.name + "2").length, bytes2.length);
+ } catch (JMSException jmsEx) {
+ jmsEx.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ @Test
+ public void testGetObject() throws JMSException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ Boolean booleanValue = Boolean.TRUE;
+ Byte byteValue = Byte.valueOf("1");
+ byte[] bytesValue = new byte[3];
+ Character charValue = new Character('a');
+ Double doubleValue = Double.valueOf("1.5");
+ Float floatValue = Float.valueOf("1.5");
+ Integer intValue = Integer.valueOf("1");
+ Long longValue = Long.valueOf("1");
+ Short shortValue = Short.valueOf("1");
+ String stringValue = "string";
+
+ try {
+ msg.setObject("boolean", booleanValue);
+ msg.setObject("byte", byteValue);
+ msg.setObject("bytes", bytesValue);
+ msg.setObject("char", charValue);
+ msg.setObject("double", doubleValue);
+ msg.setObject("float", floatValue);
+ msg.setObject("int", intValue);
+ msg.setObject("long", longValue);
+ msg.setObject("short", shortValue);
+ msg.setObject("string", stringValue);
+ } catch (MessageFormatException mfe) {
+ LOG.warn("Caught: " + mfe);
+ mfe.printStackTrace();
+ fail("object formats should be correct");
+ }
+
+ msg = msg.copy();
+
+ assertTrue(msg.getObject("boolean") instanceof Boolean);
+ assertEquals(msg.getObject("boolean"), booleanValue);
+ assertEquals(msg.getBoolean("boolean"), booleanValue.booleanValue());
+ assertTrue(msg.getObject("byte") instanceof Byte);
+ assertEquals(msg.getObject("byte"), byteValue);
+ assertEquals(msg.getByte("byte"), byteValue.byteValue());
+ assertTrue(msg.getObject("bytes") instanceof byte[]);
+ assertEquals(((byte[])msg.getObject("bytes")).length, bytesValue.length);
+ assertEquals(msg.getBytes("bytes").length, bytesValue.length);
+ assertTrue(msg.getObject("char") instanceof Character);
+ assertEquals(msg.getObject("char"), charValue);
+ assertEquals(msg.getChar("char"), charValue.charValue());
+ assertTrue(msg.getObject("double") instanceof Double);
+ assertEquals(msg.getObject("double"), doubleValue);
+ assertEquals(msg.getDouble("double"), doubleValue.doubleValue(), 0);
+ assertTrue(msg.getObject("float") instanceof Float);
+ assertEquals(msg.getObject("float"), floatValue);
+ assertEquals(msg.getFloat("float"), floatValue.floatValue(), 0);
+ assertTrue(msg.getObject("int") instanceof Integer);
+ assertEquals(msg.getObject("int"), intValue);
+ assertEquals(msg.getInt("int"), intValue.intValue());
+ assertTrue(msg.getObject("long") instanceof Long);
+ assertEquals(msg.getObject("long"), longValue);
+ assertEquals(msg.getLong("long"), longValue.longValue());
+ assertTrue(msg.getObject("short") instanceof Short);
+ assertEquals(msg.getObject("short"), shortValue);
+ assertEquals(msg.getShort("short"), shortValue.shortValue());
+ assertTrue(msg.getObject("string") instanceof String);
+ assertEquals(msg.getObject("string"), stringValue);
+ assertEquals(msg.getString("string"), stringValue);
+
+ msg.clearBody();
+ try {
+ msg.setObject("object", new Object());
+ fail("should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+
+ }
+
+ @Test
+ public void testGetMapNames() throws JMSException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ msg.setBoolean("boolean", true);
+ msg.setByte("byte", (byte)1);
+ msg.setBytes("bytes1", new byte[1]);
+ msg.setBytes("bytes2", new byte[3], 0, 2);
+ msg.setChar("char", 'a');
+ msg.setDouble("double", 1.5);
+ msg.setFloat("float", 1.5f);
+ msg.setInt("int", 1);
+ msg.setLong("long", 1);
+ msg.setObject("object", "stringObj");
+ msg.setShort("short", (short)1);
+ msg.setString("string", "string");
+
+ msg = msg.copy();
+
+ Enumeration<String> mapNamesEnum = msg.getMapNames();
+ List<String> mapNamesList = Collections.list(mapNamesEnum);
+
+ assertEquals(mapNamesList.size(), 12);
+ assertTrue(mapNamesList.contains("boolean"));
+ assertTrue(mapNamesList.contains("byte"));
+ assertTrue(mapNamesList.contains("bytes1"));
+ assertTrue(mapNamesList.contains("bytes2"));
+ assertTrue(mapNamesList.contains("char"));
+ assertTrue(mapNamesList.contains("double"));
+ assertTrue(mapNamesList.contains("float"));
+ assertTrue(mapNamesList.contains("int"));
+ assertTrue(mapNamesList.contains("long"));
+ assertTrue(mapNamesList.contains("object"));
+ assertTrue(mapNamesList.contains("short"));
+ assertTrue(mapNamesList.contains("string"));
+ }
+
+ @Test
+ public void testItemExists() throws JMSException {
+ OpenWireJMSMapMessage mapMessage = new OpenWireJMSMapMessage();
+
+ mapMessage.setString("exists", "test");
+
+ mapMessage = mapMessage.copy();
+
+ assertTrue(mapMessage.itemExists("exists"));
+ assertFalse(mapMessage.itemExists("doesntExist"));
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireJMSMapMessage mapMessage = new OpenWireJMSMapMessage();
+ mapMessage.setString("String", "String");
+ mapMessage.clearBody();
+ assertFalse(mapMessage.isReadOnlyBody());
+
+ mapMessage.getOpenWireMessage().onSend();
+ mapMessage.getOpenWireMessage().setContent(mapMessage.getOpenWireMessage().getContent());
+ assertNull(mapMessage.getString("String"));
+ mapMessage.clearBody();
+ mapMessage.setString("String", "String");
+
+ mapMessage = mapMessage.copy();
+
+ mapMessage.getString("String");
+ }
+
+ @Test
+ public void testReadOnlyBody() throws JMSException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ msg.setBoolean("boolean", true);
+ msg.setByte("byte", (byte)1);
+ msg.setBytes("bytes", new byte[1]);
+ msg.setBytes("bytes2", new byte[3], 0, 2);
+ msg.setChar("char", 'a');
+ msg.setDouble("double", 1.5);
+ msg.setFloat("float", 1.5f);
+ msg.setInt("int", 1);
+ msg.setLong("long", 1);
+ msg.setObject("object", "stringObj");
+ msg.setShort("short", (short)1);
+ msg.setString("string", "string");
+
+ msg.setReadOnlyBody(true);
+
+ try {
+ msg.getBoolean("boolean");
+ msg.getByte("byte");
+ msg.getBytes("bytes");
+ msg.getChar("char");
+ msg.getDouble("double");
+ msg.getFloat("float");
+ msg.getInt("int");
+ msg.getLong("long");
+ msg.getObject("object");
+ msg.getShort("short");
+ msg.getString("string");
+ } catch (MessageNotReadableException mnre) {
+ fail("should be readable");
+ }
+ try {
+ msg.setBoolean("boolean", true);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setByte("byte", (byte)1);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setBytes("bytes", new byte[1]);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setBytes("bytes2", new byte[3], 0, 2);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setChar("char", 'a');
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setDouble("double", 1.5);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setFloat("float", 1.5f);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setInt("int", 1);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setLong("long", 1);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setObject("object", "stringObj");
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setShort("short", (short)1);
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ try {
+ msg.setString("string", "string");
+ fail("should throw exception");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+
+ @Test
+ public void testWriteOnlyBody() throws JMSException {
+ OpenWireJMSMapMessage msg = new OpenWireJMSMapMessage();
+ msg.setReadOnlyBody(false);
+
+ msg.setBoolean("boolean", true);
+ msg.setByte("byte", (byte)1);
+ msg.setBytes("bytes", new byte[1]);
+ msg.setBytes("bytes2", new byte[3], 0, 2);
+ msg.setChar("char", 'a');
+ msg.setDouble("double", 1.5);
+ msg.setFloat("float", 1.5f);
+ msg.setInt("int", 1);
+ msg.setLong("long", 1);
+ msg.setObject("object", "stringObj");
+ msg.setShort("short", (short)1);
+ msg.setString("string", "string");
+
+ msg.setReadOnlyBody(true);
+
+ msg.getBoolean("boolean");
+ msg.getByte("byte");
+ msg.getBytes("bytes");
+ msg.getChar("char");
+ msg.getDouble("double");
+ msg.getFloat("float");
+ msg.getInt("int");
+ msg.getLong("long");
+ msg.getObject("object");
+ msg.getShort("short");
+ msg.getString("string");
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMessageTest.java b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMessageTest.java
new file mode 100644
index 0000000..f6bb646
--- /dev/null
+++ b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSMessageTest.java
@@ -0,0 +1,991 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Map;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.CommandTypes;
+import org.apache.activemq.openwire.commands.CommandVisitor;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.OpenWireTopic;
+import org.apache.activemq.openwire.commands.Response;
+import org.apache.activemq.openwire.jms.OpenWireJMSBytesMessage;
+import org.apache.activemq.openwire.jms.OpenWireJMSMessage;
+import org.fusesource.hawtbuf.Buffer;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Tests for the OpenWireJMSMessage wrapper class.
+ */
+public class OpenWireJMSMessageTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenWireJMSMessageTest.class);
+
+ protected boolean readOnlyMessage;
+
+ private String jmsMessageID;
+ private String jmsCorrelationID;
+ private OpenWireDestination jmsDestination;
+ private OpenWireDestination jmsReplyTo;
+ private int jmsDeliveryMode;
+ private boolean jmsRedelivered;
+ private String jmsType;
+ private long jmsExpiration;
+ private int jmsPriority;
+ private long jmsTimestamp;
+ private long[] consumerIDs;
+
+ @Before
+ public void setUp() throws Exception {
+ this.jmsMessageID = "ID:TEST-ID:0:0:0:1";
+ this.jmsCorrelationID = "testcorrelationid";
+ this.jmsDestination = new OpenWireTopic("test.topic");
+ this.jmsReplyTo = new OpenWireTopic("test.replyto.topic:001");
+ this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
+ this.jmsRedelivered = true;
+ this.jmsType = "test type";
+ this.jmsExpiration = 100000;
+ this.jmsPriority = 5;
+ this.jmsTimestamp = System.currentTimeMillis();
+ this.readOnlyMessage = false;
+ this.consumerIDs = new long[3];
+ for (int i = 0; i < this.consumerIDs.length; i++) {
+ this.consumerIDs[i] = i;
+ }
+ }
+
+ @Test
+ public void testGetDataStructureType() {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ assertEquals(msg.getOpenWireMessage().getDataStructureType(), CommandTypes.OPENWIRE_MESSAGE);
+ }
+
+ @Test
+ public void testHashCode() throws Exception {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSMessageID(this.jmsMessageID);
+ assertTrue(msg.getJMSMessageID().hashCode() == jmsMessageID.hashCode());
+ }
+
+ @Test
+ public void testSetReadOnly() {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setReadOnlyProperties(true);
+ boolean test = false;
+ try {
+ msg.setIntProperty("test", 1);
+ } catch (MessageNotWriteableException me) {
+ test = true;
+ } catch (JMSException e) {
+ e.printStackTrace(System.err);
+ test = false;
+ }
+ assertTrue(test);
+ }
+
+ @Test
+ public void testSetToForeignJMSID() throws Exception {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSMessageID("ID:EMS-SERVER.8B443C380083:429");
+ }
+
+ @Test
+ public void testEqualsObject() throws Exception {
+ OpenWireJMSMessage msg1 = new OpenWireJMSMessage();
+ OpenWireJMSMessage msg2 = new OpenWireJMSMessage();
+ msg1.setJMSMessageID(this.jmsMessageID);
+ assertTrue(!msg1.equals(msg2));
+ msg2.setJMSMessageID(this.jmsMessageID);
+ assertTrue(msg1.equals(msg2));
+ }
+
+ @Test
+ public void testShallowCopy() throws Exception {
+ OpenWireJMSMessage msg1 = new OpenWireJMSMessage();
+ msg1.setJMSMessageID(jmsMessageID);
+ OpenWireJMSMessage msg2 = msg1.copy();
+ assertTrue(msg1 != msg2 && msg1.equals(msg2));
+ }
+
+ @Test
+ public void testCopy() throws Exception {
+ this.jmsMessageID = "testid";
+ this.jmsCorrelationID = "testcorrelationid";
+ this.jmsDestination = new OpenWireTopic("test.topic");
+ this.jmsReplyTo = new OpenWireTopic("test.replyto.topic:001");
+ this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
+ this.jmsRedelivered = true;
+ this.jmsType = "test type";
+ this.jmsExpiration = 100000;
+ this.jmsPriority = 5;
+ this.jmsTimestamp = System.currentTimeMillis();
+ this.readOnlyMessage = false;
+
+ OpenWireJMSMessage msg1 = new OpenWireJMSMessage();
+ msg1.setJMSMessageID(this.jmsMessageID);
+ msg1.setJMSCorrelationID(this.jmsCorrelationID);
+ msg1.setJMSDestination(this.jmsDestination);
+ msg1.setJMSReplyTo(this.jmsReplyTo);
+ msg1.setJMSDeliveryMode(this.jmsDeliveryMode);
+ msg1.setJMSRedelivered(this.jmsRedelivered);
+ msg1.setJMSType(this.jmsType);
+ msg1.setJMSExpiration(this.jmsExpiration);
+ msg1.setJMSPriority(this.jmsPriority);
+ msg1.setJMSTimestamp(this.jmsTimestamp);
+ msg1.setReadOnlyProperties(true);
+
+ OpenWireJMSMessage msg2 = msg1.copy();
+
+ assertEquals(msg1.getJMSMessageID(), msg2.getJMSMessageID());
+ assertTrue(msg1.getJMSCorrelationID().equals(msg2.getJMSCorrelationID()));
+ assertTrue(msg1.getJMSDestination().equals(msg2.getJMSDestination()));
+ assertTrue(msg1.getJMSReplyTo().equals(msg2.getJMSReplyTo()));
+ assertTrue(msg1.getJMSDeliveryMode() == msg2.getJMSDeliveryMode());
+ assertTrue(msg1.getJMSRedelivered() == msg2.getJMSRedelivered());
+ assertTrue(msg1.getJMSType().equals(msg2.getJMSType()));
+ assertTrue(msg1.getJMSExpiration() == msg2.getJMSExpiration());
+ assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority());
+ assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp());
+
+ LOG.info("Message is: {}", msg1);
+ }
+
+ @Test
+ public void testGetAndSetJMSMessageID() throws Exception {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSMessageID(this.jmsMessageID);
+ assertEquals(msg.getJMSMessageID(), this.jmsMessageID);
+ }
+
+ @Test
+ public void testGetAndSetJMSTimestamp() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSTimestamp(this.jmsTimestamp);
+ assertTrue(msg.getJMSTimestamp() == this.jmsTimestamp);
+ }
+
+ @Test
+ public void testGetJMSCorrelationIDAsBytes() throws Exception {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSCorrelationID(this.jmsCorrelationID);
+ byte[] testbytes = msg.getJMSCorrelationIDAsBytes();
+ String str2 = new String(testbytes);
+ assertTrue(this.jmsCorrelationID.equals(str2));
+ }
+
+ @Test
+ public void testSetJMSCorrelationIDAsBytes() throws Exception {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ byte[] testbytes = this.jmsCorrelationID.getBytes();
+ msg.setJMSCorrelationIDAsBytes(testbytes);
+ testbytes = msg.getJMSCorrelationIDAsBytes();
+ String str2 = new String(testbytes);
+ assertTrue(this.jmsCorrelationID.equals(str2));
+ }
+
+ @Test
+ public void testGetAndSetJMSCorrelationID() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSCorrelationID(this.jmsCorrelationID);
+ assertTrue(msg.getJMSCorrelationID().equals(this.jmsCorrelationID));
+ }
+
+ @Test
+ public void testGetAndSetJMSReplyTo() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSReplyTo(this.jmsReplyTo);
+ assertTrue(msg.getJMSReplyTo().equals(this.jmsReplyTo));
+ }
+
+ @Test
+ public void testGetAndSetJMSDestination() throws Exception {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSDestination(this.jmsDestination);
+ assertTrue(msg.getJMSDestination().equals(this.jmsDestination));
+ }
+
+ @Test
+ public void testGetAndSetJMSDeliveryMode() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSDeliveryMode(this.jmsDeliveryMode);
+ assertTrue(msg.getJMSDeliveryMode() == this.jmsDeliveryMode);
+ }
+
+ @Test
+ public void testGetAndSetMSRedelivered() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSRedelivered(this.jmsRedelivered);
+ assertTrue(msg.getJMSRedelivered() == this.jmsRedelivered);
+ }
+
+ @Test
+ public void testGetAndSetJMSType() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSType(this.jmsType);
+ assertTrue(msg.getJMSType().equals(this.jmsType));
+ }
+
+ @Test
+ public void testGetAndSetJMSExpiration() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSExpiration(this.jmsExpiration);
+ assertTrue(msg.getJMSExpiration() == this.jmsExpiration);
+ }
+
+ @Test
+ public void testGetAndSetJMSPriority() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSPriority(this.jmsPriority);
+ assertTrue(msg.getJMSPriority() == this.jmsPriority);
+
+ msg.setJMSPriority(-90);
+ assertEquals(0, msg.getJMSPriority());
+
+ msg.setJMSPriority(90);
+ assertEquals(9, msg.getJMSPriority());
+ }
+
+ @Test
+ public void testClearProperties() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setStringProperty("test", "test");
+ msg.setJMSMessageID(this.jmsMessageID);
+ msg.getOpenWireMessage().setContent(new Buffer(new byte[] {1, 0, 0}));
+ msg.clearProperties();
+ assertNull(msg.getStringProperty("test"));
+ assertNotNull(msg.getJMSMessageID());
+ assertNotNull(msg.getOpenWireMessage().getContent());
+ }
+
+ @Test
+ public void testPropertyExists() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setStringProperty("test", "test");
+ assertTrue(msg.propertyExists("test"));
+
+ msg.setIntProperty("JMSXDeliveryCount", 1);
+ assertTrue(msg.propertyExists("JMSXDeliveryCount"));
+ }
+
+ @Test
+ public void testGetBooleanProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "booleanProperty";
+ msg.setBooleanProperty(name, true);
+ assertTrue(msg.getBooleanProperty(name));
+ }
+
+ @Test
+ public void testGetByteProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "byteProperty";
+ msg.setByteProperty(name, (byte) 1);
+ assertTrue(msg.getByteProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetShortProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "shortProperty";
+ msg.setShortProperty(name, (short) 1);
+ assertTrue(msg.getShortProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetIntProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "intProperty";
+ msg.setIntProperty(name, 1);
+ assertTrue(msg.getIntProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetLongProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "longProperty";
+ msg.setLongProperty(name, 1);
+ assertTrue(msg.getLongProperty(name) == 1);
+ }
+
+ @Test
+ public void testGetFloatProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "floatProperty";
+ msg.setFloatProperty(name, 1.3f);
+ assertTrue(msg.getFloatProperty(name) == 1.3f);
+ }
+
+ @Test
+ public void testGetDoubleProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "doubleProperty";
+ msg.setDoubleProperty(name, 1.3d);
+ assertTrue(msg.getDoubleProperty(name) == 1.3);
+ }
+
+ @Test
+ public void testGetStringProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "stringProperty";
+ msg.setStringProperty(name, name);
+ assertTrue(msg.getStringProperty(name).equals(name));
+ }
+
+ @Test
+ public void testGetObjectProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "floatProperty";
+ msg.setFloatProperty(name, 1.3f);
+ assertTrue(msg.getObjectProperty(name) instanceof Float);
+ assertTrue(((Float) msg.getObjectProperty(name)).floatValue() == 1.3f);
+ }
+
+ @Test
+ public void testGetPropertyNames() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name1 = "floatProperty";
+ msg.setFloatProperty(name1, 1.3f);
+ String name2 = "JMSXDeliveryCount";
+ msg.setIntProperty(name2, 1);
+ String name3 = "JMSRedelivered";
+ msg.setBooleanProperty(name3, false);
+ boolean found1 = false;
+ boolean found2 = false;
+ boolean found3 = false;
+ for (Enumeration<?> iter = msg.getPropertyNames(); iter.hasMoreElements();) {
+ Object element = iter.nextElement();
+ found1 |= element.equals(name1);
+ found2 |= element.equals(name2);
+ found3 |= element.equals(name3);
+ }
+ assertTrue("prop name1 found", found1);
+ // spec compliance, only non JMS (and JMSX) props returned
+ assertFalse("prop name2 not found", found2);
+ assertFalse("prop name4 not found", found3);
+ }
+
+ @Test
+ public void testGetAllPropertyNames() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name1 = "floatProperty";
+ msg.setFloatProperty(name1, 1.3f);
+ String name2 = "JMSXDeliveryCount";
+ msg.setIntProperty(name2, 1);
+ String name3 = "JMSRedelivered";
+ msg.setBooleanProperty(name3, false);
+ boolean found1 = false;
+ boolean found2 = false;
+ boolean found3 = false;
+ for (Enumeration<?> iter = msg.getAllPropertyNames(); iter.hasMoreElements();) {
+ Object element = iter.nextElement();
+ found1 |= element.equals(name1);
+ found2 |= element.equals(name2);
+ found3 |= element.equals(name3);
+ }
+ assertTrue("prop name1 found", found1);
+ assertTrue("prop name2 found", found2);
+ assertTrue("prop name4 found", found3);
+ }
+
+ @Test
+ public void testSetObjectProperty() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String name = "property";
+
+ try {
+ msg.setObjectProperty(name, "string");
+ msg.setObjectProperty(name, Byte.valueOf("1"));
+ msg.setObjectProperty(name, Short.valueOf("1"));
+ msg.setObjectProperty(name, Integer.valueOf("1"));
+ msg.setObjectProperty(name, Long.valueOf("1"));
+ msg.setObjectProperty(name, Float.valueOf("1.1f"));
+ msg.setObjectProperty(name, Double.valueOf("1.1"));
+ msg.setObjectProperty(name, Boolean.TRUE);
+ msg.setObjectProperty(name, null);
+ } catch (MessageFormatException e) {
+ fail("should accept object primitives and String");
+ }
+ try {
+ msg.setObjectProperty(name, new byte[5]);
+ fail("should accept only object primitives and String");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.setObjectProperty(name, new Object());
+ fail("should accept only object primitives and String");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testConvertProperties() throws Exception {
+ org.apache.activemq.openwire.commands.Message msg = new org.apache.activemq.openwire.commands.Message() {
+ @Override
+ public org.apache.activemq.openwire.commands.Message copy() {
+ return null;
+ }
+
+ @Override
+ public void beforeMarshall(OpenWireFormat wireFormat) throws IOException {
+ super.beforeMarshall(wireFormat);
+ }
+
+ @Override
+ public byte getDataStructureType() {
+ return 0;
+ }
+
+ @Override
+ public Response visit(CommandVisitor visitor) throws Exception {
+ return null;
+ }
+
+ @Override
+ public void clearBody() throws JMSException {
+ }
+
+ @Override
+ public void storeContent() {
+ }
+
+ @Override
+ public void storeContentAndClear() {
+
+ }
+ };
+
+ msg.setProperty("stringProperty", "string");
+ msg.setProperty("byteProperty", Byte.valueOf("1"));
+ msg.setProperty("shortProperty", Short.valueOf("1"));
+ msg.setProperty("intProperty", Integer.valueOf("1"));
+ msg.setProperty("longProperty", Long.valueOf("1"));
+ msg.setProperty("floatProperty", Float.valueOf("1.1f"));
+ msg.setProperty("doubleProperty", Double.valueOf("1.1"));
+ msg.setProperty("booleanProperty", Boolean.TRUE);
+ msg.setProperty("nullProperty", null);
+
+ msg.beforeMarshall(new OpenWireFormat(OpenWireFormat.DEFAULT_WIRE_VERSION));
+
+ Map<String, Object> properties = msg.getProperties();
+ assertEquals(properties.get("stringProperty"), "string");
+ assertEquals(((Byte) properties.get("byteProperty")).byteValue(), 1);
+ assertEquals(((Short) properties.get("shortProperty")).shortValue(), 1);
+ assertEquals(((Integer) properties.get("intProperty")).intValue(), 1);
+ assertEquals(((Long) properties.get("longProperty")).longValue(), 1);
+ assertEquals(((Float) properties.get("floatProperty")).floatValue(), 1.1f, 0);
+ assertEquals(((Double) properties.get("doubleProperty")).doubleValue(), 1.1, 0);
+ assertEquals(((Boolean) properties.get("booleanProperty")).booleanValue(), true);
+ assertNull(properties.get("nullProperty"));
+ }
+
+ @Test
+ public void testSetNullProperty() throws JMSException {
+ Message msg = new OpenWireJMSMessage();
+ String name = "cheese";
+ msg.setStringProperty(name, "Cheddar");
+ assertEquals("Cheddar", msg.getStringProperty(name));
+
+ msg.setStringProperty(name, null);
+ assertEquals(null, msg.getStringProperty(name));
+ }
+
+ @Test
+ public void testSetNullPropertyName() throws JMSException {
+ Message msg = new OpenWireJMSMessage();
+
+ try {
+ msg.setStringProperty(null, "Cheese");
+ fail("Should have thrown exception");
+ } catch (IllegalArgumentException e) {
+ LOG.info("Worked, caught: " + e);
+ }
+ }
+
+ @Test
+ public void testSetEmptyPropertyName() throws JMSException {
+ Message msg = new OpenWireJMSMessage();
+
+ try {
+ msg.setStringProperty("", "Cheese");
+ fail("Should have thrown exception");
+ } catch (IllegalArgumentException e) {
+ LOG.info("Worked, caught: " + e);
+ }
+ }
+
+ @Test
+ public void testGetAndSetJMSXDeliveryCount() throws JMSException {
+ Message msg = new OpenWireJMSMessage();
+ msg.setIntProperty("JMSXDeliveryCount", 1);
+ int count = msg.getIntProperty("JMSXDeliveryCount");
+ assertTrue("expected delivery count = 1 - got: " + count, count == 1);
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireJMSBytesMessage message = new OpenWireJMSBytesMessage();
+ message.clearBody();
+ assertFalse(message.isReadOnlyBody());
+ assertNull(message.getOpenWireMessage().getContent());
+ }
+
+ @Test
+ public void testBooleanPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setBooleanProperty(propertyName, true);
+
+ assertEquals(((Boolean) msg.getObjectProperty(propertyName)).booleanValue(), true);
+ assertTrue(msg.getBooleanProperty(propertyName));
+ assertEquals(msg.getStringProperty(propertyName), "true");
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getIntProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getLongProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testBytePropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setByteProperty(propertyName, (byte) 1);
+
+ assertEquals(((Byte) msg.getObjectProperty(propertyName)).byteValue(), 1);
+ assertEquals(msg.getByteProperty(propertyName), 1);
+ assertEquals(msg.getShortProperty(propertyName), 1);
+ assertEquals(msg.getIntProperty(propertyName), 1);
+ assertEquals(msg.getLongProperty(propertyName), 1);
+ assertEquals(msg.getStringProperty(propertyName), "1");
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testShortPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setShortProperty(propertyName, (short) 1);
+
+ assertEquals(((Short) msg.getObjectProperty(propertyName)).shortValue(), 1);
+ assertEquals(msg.getShortProperty(propertyName), 1);
+ assertEquals(msg.getIntProperty(propertyName), 1);
+ assertEquals(msg.getLongProperty(propertyName), 1);
+ assertEquals(msg.getStringProperty(propertyName), "1");
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testIntPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setIntProperty(propertyName, 1);
+
+ assertEquals(((Integer) msg.getObjectProperty(propertyName)).intValue(), 1);
+ assertEquals(msg.getIntProperty(propertyName), 1);
+ assertEquals(msg.getLongProperty(propertyName), 1);
+ assertEquals(msg.getStringProperty(propertyName), "1");
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testLongPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setLongProperty(propertyName, 1);
+
+ assertEquals(((Long) msg.getObjectProperty(propertyName)).longValue(), 1);
+ assertEquals(msg.getLongProperty(propertyName), 1);
+ assertEquals(msg.getStringProperty(propertyName), "1");
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getIntProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testFloatPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setFloatProperty(propertyName, (float) 1.5);
+ assertEquals(((Float) msg.getObjectProperty(propertyName)).floatValue(), 1.5, 0);
+ assertEquals(msg.getFloatProperty(propertyName), 1.5, 0);
+ assertEquals(msg.getDoubleProperty(propertyName), 1.5, 0);
+ assertEquals(msg.getStringProperty(propertyName), "1.5");
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getIntProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getLongProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testDoublePropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setDoubleProperty(propertyName, 1.5);
+ assertEquals(((Double) msg.getObjectProperty(propertyName)).doubleValue(), 1.5, 0);
+ assertEquals(msg.getDoubleProperty(propertyName), 1.5, 0);
+ assertEquals(msg.getStringProperty(propertyName), "1.5");
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getIntProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getLongProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testStringPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ String stringValue = "true";
+ msg.setStringProperty(propertyName, stringValue);
+ assertEquals(msg.getStringProperty(propertyName), stringValue);
+ assertEquals(msg.getObjectProperty(propertyName), stringValue);
+ assertEquals(msg.getBooleanProperty(propertyName), true);
+
+ stringValue = "1";
+ msg.setStringProperty(propertyName, stringValue);
+ assertEquals(msg.getByteProperty(propertyName), 1);
+ assertEquals(msg.getShortProperty(propertyName), 1);
+ assertEquals(msg.getIntProperty(propertyName), 1);
+ assertEquals(msg.getLongProperty(propertyName), 1);
+
+ stringValue = "1.5";
+ msg.setStringProperty(propertyName, stringValue);
+ assertEquals(msg.getFloatProperty(propertyName), 1.5, 0);
+ assertEquals(msg.getDoubleProperty(propertyName), 1.5, 0);
+
+ stringValue = "bad";
+ msg.setStringProperty(propertyName, stringValue);
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (NumberFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (NumberFormatException e) {
+ }
+ try {
+ msg.getIntProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (NumberFormatException e) {
+ }
+ try {
+ msg.getLongProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (NumberFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (NumberFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (NumberFormatException e) {
+ }
+ assertFalse(msg.getBooleanProperty(propertyName));
+ }
+
+ @Test
+ public void testObjectPropertyConversion() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ Object obj = new Object();
+ try {
+ // Bypass normal checks.
+ msg.getOpenWireMessage().setProperty(propertyName, obj, false);
+ } catch (Exception e) {
+ }
+ try {
+ msg.getStringProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getBooleanProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getByteProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getShortProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getIntProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getLongProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getFloatProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ try {
+ msg.getDoubleProperty(propertyName);
+ fail("Should have thrown exception");
+ } catch (MessageFormatException e) {
+ }
+ }
+
+ @Test
+ public void testReadOnlyProperties() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ String propertyName = "property";
+ msg.setReadOnlyProperties(true);
+
+ try {
+ msg.setObjectProperty(propertyName, new Object());
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setStringProperty(propertyName, "test");
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setBooleanProperty(propertyName, true);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setByteProperty(propertyName, (byte) 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setShortProperty(propertyName, (short) 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setIntProperty(propertyName, 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setLongProperty(propertyName, 1);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setFloatProperty(propertyName, (float) 1.5);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ try {
+ msg.setDoubleProperty(propertyName, 1.5);
+ fail("Should have thrown exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ }
+
+ @Test
+ public void testIsExpired() throws JMSException {
+ OpenWireJMSMessage msg = new OpenWireJMSMessage();
+ msg.setJMSExpiration(System.currentTimeMillis() - 1);
+ assertTrue(msg.isExpired());
+ msg.setJMSExpiration(System.currentTimeMillis() + 10000);
+ assertFalse(msg.isExpired());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessageTest.java
----------------------------------------------------------------------
diff --git a/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessageTest.java b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessageTest.java
new file mode 100644
index 0000000..b40fe1e
--- /dev/null
+++ b/openwire-jms/src/test/java/org/apache/activemq/openwire/jms/OpenWireJMSObjectMessageTest.java
@@ -0,0 +1,110 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import javax.jms.JMSException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+
+import org.apache.activemq.openwire.jms.OpenWireJMSObjectMessage;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class OpenWireJMSObjectMessageTest {
+
+ @Test
+ public void testBytes() throws JMSException, IOException {
+ OpenWireJMSObjectMessage msg = new OpenWireJMSObjectMessage();
+ String str = "testText";
+ msg.setObject(str);
+
+ msg = msg.copy();
+ assertEquals(msg.getObject(), str);
+ }
+
+ @Test
+ public void testSetObject() throws JMSException {
+ OpenWireJMSObjectMessage msg = new OpenWireJMSObjectMessage();
+ String str = "testText";
+ msg.setObject(str);
+ assertTrue(msg.getObject() == str);
+ }
+
+ @Test
+ public void testClearBody() throws JMSException {
+ OpenWireJMSObjectMessage objectMessage = new OpenWireJMSObjectMessage();
+ try {
+ objectMessage.setObject("String");
+ objectMessage.clearBody();
+ assertFalse(objectMessage.isReadOnlyBody());
+ assertNull(objectMessage.getObject());
+ objectMessage.setObject("String");
+ objectMessage.getObject();
+ } catch (MessageNotWriteableException mnwe) {
+ fail("should be writeable");
+ }
+ }
+
+ @Test
+ public void testReadOnlyBody() throws JMSException {
+ OpenWireJMSObjectMessage msg = new OpenWireJMSObjectMessage();
+ msg.setObject("test");
+ msg.setReadOnlyBody(true);
+ try {
+ msg.getObject();
+ } catch (MessageNotReadableException e) {
+ fail("should be readable");
+ }
+ try {
+ msg.setObject("test");
+ fail("should throw exception");
+ } catch (MessageNotWriteableException e) {
+ }
+ }
+
+ @Test
+ public void testWriteOnlyBody() throws JMSException {
+ // should always be readable
+ OpenWireJMSObjectMessage msg = new OpenWireJMSObjectMessage();
+ msg.setReadOnlyBody(false);
+ try {
+ msg.setObject("test");
+ msg.getObject();
+ } catch (MessageNotReadableException e) {
+ fail("should be readable");
+ }
+ msg.setReadOnlyBody(true);
+ try {
+ msg.getObject();
+ msg.setObject("test");
+ fail("should throw exception");
+ } catch (MessageNotReadableException e) {
+ fail("should be readable");
+ } catch (MessageNotWriteableException mnwe) {
+ }
+ }
+}
[50/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
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);
+ }
+}
[18/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataArrayResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..872ecbb
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataArrayResponseMarshaller.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.v4;
+
+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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ DataStructure value[] = new DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataResponseMarshaller.java
new file mode 100644
index 0000000..336e0d2
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v4;
+
+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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DestinationInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..65c4f74
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DestinationInfoMarshaller.java
@@ -0,0 +1,165 @@
+/**
+ * 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.v4;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ BrokerId value[] = new BrokerId[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setBrokerPath(value);
+ } else {
+ info.setBrokerPath(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DiscoveryEventMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..b988f76
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/DiscoveryEventMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ExceptionResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..974500f
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/FlushCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/FlushCommandMarshaller.java
new file mode 100644
index 0000000..4062d5e
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/FlushCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/IntegerResponseMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..c36da75
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalQueueAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..364ac47
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalQueueAckMarshaller.java
@@ -0,0 +1,131 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTopicAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..69f9a12
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTopicAckMarshaller.java
@@ -0,0 +1,152 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTraceMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTraceMarshaller.java
new file mode 100644
index 0000000..b6783f9
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTraceMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTransactionMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..47d08cb
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/JournalTransactionMarshaller.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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/KeepAliveInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..9a796d6
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/KeepAliveInfoMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..acc5147
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LastPartialCommandMarshaller.java
@@ -0,0 +1,108 @@
+/**
+ * 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.v4;
+
+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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LocalTransactionIdMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LocalTransactionIdMarshaller.java
new file mode 100644
index 0000000..b737510
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/LocalTransactionIdMarshaller.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.v4;
+
+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.ConnectionId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.LocalTransactionId;
+
+public class LocalTransactionIdMarshaller extends TransactionIdMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LocalTransactionId.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LocalTransactionId();
+ }
+
+ /**
+ * 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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(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 {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
+ rc += tightMarshalCachedObject1(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
+ tightMarshalCachedObject2(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);
+
+ LocalTransactionId info = (LocalTransactionId) o;
+ info.setValue(looseUnmarshalLong(wireFormat, dataIn));
+ info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ LocalTransactionId info = (LocalTransactionId) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalLong(wireFormat, info.getValue(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MarshallerFactory.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MarshallerFactory.java
new file mode 100644
index 0000000..4cbe76a
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MarshallerFactory.java
@@ -0,0 +1,95 @@
+/**
+ * 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.v4;
+
+import org.apache.activemq.openwire.codec.DataStreamMarshaller;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+
+public class MarshallerFactory {
+
+ /**
+ * Creates a Map of command type -> Marshallers
+ */
+ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];
+ static {
+
+ add(new OpenWireBlobMessageMarshaller());
+ add(new OpenWireBytesMessageMarshaller());
+ add(new OpenWireMapMessageMarshaller());
+ add(new OpenWireMessageMarshaller());
+ add(new OpenWireObjectMessageMarshaller());
+ add(new OpenWireQueueMarshaller());
+ add(new OpenWireStreamMessageMarshaller());
+ add(new OpenWireTempQueueMarshaller());
+ add(new OpenWireTempTopicMarshaller());
+ add(new OpenWireTextMessageMarshaller());
+ add(new OpenWireTopicMarshaller());
+ add(new BrokerIdMarshaller());
+ add(new BrokerInfoMarshaller());
+ add(new ConnectionControlMarshaller());
+ add(new ConnectionErrorMarshaller());
+ add(new ConnectionIdMarshaller());
+ add(new ConnectionInfoMarshaller());
+ add(new ConsumerControlMarshaller());
+ add(new ConsumerIdMarshaller());
+ add(new ConsumerInfoMarshaller());
+ add(new ControlCommandMarshaller());
+ add(new DataArrayResponseMarshaller());
+ add(new DataResponseMarshaller());
+ add(new DestinationInfoMarshaller());
+ add(new DiscoveryEventMarshaller());
+ add(new ExceptionResponseMarshaller());
+ add(new FlushCommandMarshaller());
+ add(new IntegerResponseMarshaller());
+ add(new JournalQueueAckMarshaller());
+ add(new JournalTopicAckMarshaller());
+ add(new JournalTraceMarshaller());
+ add(new JournalTransactionMarshaller());
+ add(new KeepAliveInfoMarshaller());
+ add(new LastPartialCommandMarshaller());
+ add(new LocalTransactionIdMarshaller());
+ add(new MessageAckMarshaller());
+ add(new MessageDispatchMarshaller());
+ add(new MessageDispatchNotificationMarshaller());
+ add(new MessageIdMarshaller());
+ add(new MessagePullMarshaller());
+ add(new NetworkBridgeFilterMarshaller());
+ add(new PartialCommandMarshaller());
+ add(new ProducerAckMarshaller());
+ add(new ProducerIdMarshaller());
+ add(new ProducerInfoMarshaller());
+ add(new RemoveInfoMarshaller());
+ add(new RemoveSubscriptionInfoMarshaller());
+ add(new ReplayCommandMarshaller());
+ add(new ResponseMarshaller());
+ add(new SessionIdMarshaller());
+ add(new SessionInfoMarshaller());
+ add(new ShutdownInfoMarshaller());
+ add(new SubscriptionInfoMarshaller());
+ add(new TransactionInfoMarshaller());
+ add(new WireFormatInfoMarshaller());
+ add(new XATransactionIdMarshaller());
+ }
+
+ static private void add(DataStreamMarshaller dsm) {
+ marshaller[dsm.getDataStructureType()] = dsm;
+ }
+
+ static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {
+ return marshaller;
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageAckMarshaller.java
new file mode 100644
index 0000000..05d2125
--- /dev/null
+++ b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/MessageAckMarshaller.java
@@ -0,0 +1,155 @@
+/**
+ * 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.v4;
+
+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.ConsumerId;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.MessageAck;
+import org.apache.activemq.openwire.commands.MessageId;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+import org.apache.activemq.openwire.commands.TransactionId;
+
+public class MessageAckMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return MessageAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new MessageAck();
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs);
+
+ return rc + 5;
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ dataOut.writeByte(info.getAckType());
+ tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs);
+ dataOut.writeInt(info.getMessageCount());
+ }
+
+ /**
+ * 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);
+
+ MessageAck info = (MessageAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setAckType(dataIn.readByte());
+ info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageCount(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ MessageAck info = (MessageAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeByte(info.getAckType());
+ looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut);
+ dataOut.writeInt(info.getMessageCount());
+ }
+}
[49/51] [partial] https://issues.apache.org/jira/browse/OPENWIRE-1
Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerInfoMarshaller.java
new file mode 100644
index 0000000..d7bc4f0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ConsumerInfoMarshaller.java
@@ -0,0 +1,222 @@
+/**
+ * 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.ConsumerInfo;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ConsumerInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ConsumerInfo();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((org.apache.activemq.openwire.commands.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setBrowser(bs.readBoolean());
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(bs.readBoolean());
+ info.setSelector(tightUnmarshalString(dataIn, bs));
+ info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
+ info.setNoLocal(bs.readBoolean());
+ info.setExclusive(bs.readBoolean());
+ info.setRetroactive(bs.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ org.apache.activemq.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.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setNetworkSubscription(bs.readBoolean());
+ info.setOptimizedAcknowledge(bs.readBoolean());
+ info.setNoRangeAcks(bs.readBoolean());
+
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs);
+ bs.writeBoolean(info.isBrowser());
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ bs.writeBoolean(info.isDispatchAsync());
+ rc += tightMarshalString1(info.getSelector(), bs);
+ rc += tightMarshalString1(info.getSubscriptionName(), bs);
+ bs.writeBoolean(info.isNoLocal());
+ bs.writeBoolean(info.isExclusive());
+ bs.writeBoolean(info.isRetroactive());
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs);
+ bs.writeBoolean(info.isNetworkSubscription());
+ bs.writeBoolean(info.isOptimizedAcknowledge());
+ bs.writeBoolean(info.isNoRangeAcks());
+
+ return rc + 9;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o
+ * the instance to be marshaled
+ * @param dataOut
+ * the output stream
+ * @throws IOException
+ * thrown if an error occurs
+ */
+ @Override
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs);
+ bs.readBoolean();
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ bs.readBoolean();
+ tightMarshalString2(info.getSelector(), dataOut, bs);
+ tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ dataOut.writeByte(info.getPriority());
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs);
+ bs.readBoolean();
+ bs.readBoolean();
+ bs.readBoolean();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o
+ * the object to un-marshal
+ * @param dataIn
+ * the data input stream to build the object from
+ * @throws IOException
+ */
+ @Override
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ ConsumerInfo info = (ConsumerInfo) o;
+ info.setConsumerId((org.apache.activemq.openwire.commands.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setBrowser(dataIn.readBoolean());
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setPrefetchSize(dataIn.readInt());
+ info.setMaximumPendingMessageLimit(dataIn.readInt());
+ info.setDispatchAsync(dataIn.readBoolean());
+ info.setSelector(looseUnmarshalString(dataIn));
+ info.setSubscriptionName(looseUnmarshalString(dataIn));
+ info.setNoLocal(dataIn.readBoolean());
+ info.setExclusive(dataIn.readBoolean());
+ info.setRetroactive(dataIn.readBoolean());
+ info.setPriority(dataIn.readByte());
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ org.apache.activemq.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.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setNetworkSubscription(dataIn.readBoolean());
+ info.setOptimizedAcknowledge(dataIn.readBoolean());
+ info.setNoRangeAcks(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ConsumerInfo info = (ConsumerInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut);
+ dataOut.writeBoolean(info.isBrowser());
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeInt(info.getPrefetchSize());
+ dataOut.writeInt(info.getMaximumPendingMessageLimit());
+ dataOut.writeBoolean(info.isDispatchAsync());
+ looseMarshalString(info.getSelector(), dataOut);
+ looseMarshalString(info.getSubscriptionName(), dataOut);
+ dataOut.writeBoolean(info.isNoLocal());
+ dataOut.writeBoolean(info.isExclusive());
+ dataOut.writeBoolean(info.isRetroactive());
+ dataOut.writeByte(info.getPriority());
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut);
+ dataOut.writeBoolean(info.isNetworkSubscription());
+ dataOut.writeBoolean(info.isOptimizedAcknowledge());
+ dataOut.writeBoolean(info.isNoRangeAcks());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ControlCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ControlCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ControlCommandMarshaller.java
new file mode 100644
index 0000000..481b3e6
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ControlCommandMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.ControlCommand;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class ControlCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ControlCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ControlCommand();
+ }
+
+ /**
+ * 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(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 {
+ ControlCommand info = (ControlCommand) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ tightMarshalString2(info.getCommand(), 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);
+
+ ControlCommand info = (ControlCommand) o;
+ info.setCommand(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ControlCommand info = (ControlCommand) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getCommand(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataArrayResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataArrayResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataArrayResponseMarshaller.java
new file mode 100644
index 0000000..a5fe6f2
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataArrayResponseMarshaller.java
@@ -0,0 +1,143 @@
+/**
+ * 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.DataArrayResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataArrayResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataArrayResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataArrayResponse();
+ }
+
+ /**
+ * 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (bs.readBoolean()) {
+ short size = dataIn.readShort();
+ org.apache.activemq.openwire.commands.DataStructure value[] = new org.apache.activemq.openwire.commands.DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+ tightMarshalObjectArray2(wireFormat, info.getData(), 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);
+
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ if (dataIn.readBoolean()) {
+ short size = dataIn.readShort();
+ org.apache.activemq.openwire.commands.DataStructure value[] = new org.apache.activemq.openwire.commands.DataStructure[size];
+ for (int i = 0; i < size; i++) {
+ value[i] = looseUnmarsalNestedObject(wireFormat, dataIn);
+ }
+ info.setData(value);
+ } else {
+ info.setData(null);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DataArrayResponse info = (DataArrayResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataResponseMarshaller.java
new file mode 100644
index 0000000..dd472ec
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.DataResponse;
+import org.apache.activemq.openwire.commands.DataStructure;
+
+public class DataResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DataResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DataResponse();
+ }
+
+ /**
+ * 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ tightMarshalNestedObject2(wireFormat, info.getData(), 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);
+
+ DataResponse info = (DataResponse) o;
+ info.setData(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 {
+ DataResponse info = (DataResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getData(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataStructureSupportMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataStructureSupportMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataStructureSupportMarshaller.java
new file mode 100644
index 0000000..e9e8540
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DataStructureSupportMarshaller.java
@@ -0,0 +1,88 @@
+/**
+ * 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;
+
+public abstract class DataStructureSupportMarshaller 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DestinationInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DestinationInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DestinationInfoMarshaller.java
new file mode 100644
index 0000000..0010b19
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DestinationInfoMarshaller.java
@@ -0,0 +1,164 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.DestinationInfo;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class DestinationInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DestinationInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DestinationInfo();
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((org.apache.activemq.openwire.commands.ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(tightUnmarshalLong(wireFormat, 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);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ DestinationInfo info = (DestinationInfo) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs);
+ rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
+ rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs);
+ tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ dataOut.writeByte(info.getOperationType());
+ tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
+ tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), 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);
+
+ DestinationInfo info = (DestinationInfo) o;
+ info.setConnectionId((org.apache.activemq.openwire.commands.ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
+ info.setOperationType(dataIn.readByte());
+ info.setTimeout(looseUnmarshalLong(wireFormat, 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);
+ }
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DestinationInfo info = (DestinationInfo) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut);
+ looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
+ dataOut.writeByte(info.getOperationType());
+ looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
+ looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DiscoveryEventMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DiscoveryEventMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DiscoveryEventMarshaller.java
new file mode 100644
index 0000000..d300e08
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/DiscoveryEventMarshaller.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.BaseDataStreamMarshaller;
+import org.apache.activemq.openwire.codec.BooleanStream;
+import org.apache.activemq.openwire.codec.OpenWireFormat;
+import org.apache.activemq.openwire.commands.DataStructure;
+import org.apache.activemq.openwire.commands.DiscoveryEvent;
+
+public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return DiscoveryEvent.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new DiscoveryEvent();
+ }
+
+ /**
+ * 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(tightUnmarshalString(dataIn, bs));
+ info.setBrokerName(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 {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getServiceName(), bs);
+ rc += tightMarshalString1(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ tightMarshalString2(info.getServiceName(), dataOut, bs);
+ tightMarshalString2(info.getBrokerName(), 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);
+
+ DiscoveryEvent info = (DiscoveryEvent) o;
+ info.setServiceName(looseUnmarshalString(dataIn));
+ info.setBrokerName(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ DiscoveryEvent info = (DiscoveryEvent) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getServiceName(), dataOut);
+ looseMarshalString(info.getBrokerName(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ExceptionResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ExceptionResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ExceptionResponseMarshaller.java
new file mode 100644
index 0000000..43dfaa0
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/ExceptionResponseMarshaller.java
@@ -0,0 +1,123 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.ExceptionResponse;
+
+public class ExceptionResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return ExceptionResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new ExceptionResponse();
+ }
+
+ /**
+ * 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(tightUnmarsalThrowable(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 {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalThrowable1(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ tightMarshalThrowable2(wireFormat, info.getException(), 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);
+
+ ExceptionResponse info = (ExceptionResponse) o;
+ info.setException(looseUnmarsalThrowable(wireFormat, dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ ExceptionResponse info = (ExceptionResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalThrowable(wireFormat, info.getException(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/FlushCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/FlushCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/FlushCommandMarshaller.java
new file mode 100644
index 0000000..f7174ba
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/FlushCommandMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.FlushCommand;
+
+public class FlushCommandMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return FlushCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new FlushCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/IntegerResponseMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/IntegerResponseMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/IntegerResponseMarshaller.java
new file mode 100644
index 0000000..9d665ab
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/IntegerResponseMarshaller.java
@@ -0,0 +1,119 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.IntegerResponse;
+
+public class IntegerResponseMarshaller extends ResponseMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return IntegerResponse.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new IntegerResponse();
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ dataOut.writeInt(info.getResult());
+ }
+
+ /**
+ * 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);
+
+ IntegerResponse info = (IntegerResponse) o;
+ info.setResult(dataIn.readInt());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ IntegerResponse info = (IntegerResponse) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getResult());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalQueueAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalQueueAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalQueueAckMarshaller.java
new file mode 100644
index 0000000..a9d334d
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalQueueAckMarshaller.java
@@ -0,0 +1,130 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalQueueAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalQueueAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalQueueAck();
+ }
+
+ /**
+ * 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageAck((org.apache.activemq.openwire.commands.MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageAck(), 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);
+
+ JournalQueueAck info = (JournalQueueAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageAck((org.apache.activemq.openwire.commands.MessageAck) 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 {
+ JournalQueueAck info = (JournalQueueAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTopicAckMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTopicAckMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTopicAckMarshaller.java
new file mode 100644
index 0000000..5ba6a60
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTopicAckMarshaller.java
@@ -0,0 +1,150 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTopicAck;
+import org.apache.activemq.openwire.commands.OpenWireDestination;
+
+public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTopicAck.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTopicAck();
+ }
+
+ /**
+ * 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageId((org.apache.activemq.openwire.commands.MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
+ info.setSubscritionName(tightUnmarshalString(dataIn, bs));
+ info.setClientId(tightUnmarshalString(dataIn, bs));
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs);
+ rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
+ rc += tightMarshalString1(info.getSubscritionName(), bs);
+ rc += tightMarshalString1(info.getClientId(), bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs);
+ tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
+ tightMarshalString2(info.getSubscritionName(), dataOut, bs);
+ tightMarshalString2(info.getClientId(), dataOut, bs);
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), 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);
+
+ JournalTopicAck info = (JournalTopicAck) o;
+ info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
+ info.setSubscritionName(looseUnmarshalString(dataIn));
+ info.setClientId(looseUnmarshalString(dataIn));
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) 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 {
+ JournalTopicAck info = (JournalTopicAck) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut);
+ looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
+ looseMarshalString(info.getSubscritionName(), dataOut);
+ looseMarshalString(info.getClientId(), dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTraceMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTraceMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTraceMarshaller.java
new file mode 100644
index 0000000..05a8c82
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTraceMarshaller.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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTrace;
+
+public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTrace.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTrace();
+ }
+
+ /**
+ * 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(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 {
+ JournalTrace info = (JournalTrace) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalString1(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ tightMarshalString2(info.getMessage(), 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);
+
+ JournalTrace info = (JournalTrace) o;
+ info.setMessage(looseUnmarshalString(dataIn));
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTrace info = (JournalTrace) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalString(info.getMessage(), dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTransactionMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTransactionMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTransactionMarshaller.java
new file mode 100644
index 0000000..bd25d45
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/JournalTransactionMarshaller.java
@@ -0,0 +1,133 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.JournalTransaction;
+
+public class JournalTransactionMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return JournalTransaction.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new JournalTransaction();
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(bs.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs);
+ bs.writeBoolean(info.getWasPrepared());
+
+ return rc + 1;
+ }
+
+ /**
+ * 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs);
+ dataOut.writeByte(info.getType());
+ 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);
+
+ JournalTransaction info = (JournalTransaction) o;
+ info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn));
+ info.setType(dataIn.readByte());
+ info.setWasPrepared(dataIn.readBoolean());
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ JournalTransaction info = (JournalTransaction) o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut);
+ dataOut.writeByte(info.getType());
+ dataOut.writeBoolean(info.getWasPrepared());
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/KeepAliveInfoMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/KeepAliveInfoMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/KeepAliveInfoMarshaller.java
new file mode 100644
index 0000000..74f4f25
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/KeepAliveInfoMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.KeepAliveInfo;
+
+public class KeepAliveInfoMarshaller extends BaseCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return KeepAliveInfo.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new KeepAliveInfo();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/7ae454fa/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java
----------------------------------------------------------------------
diff --git a/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java
new file mode 100644
index 0000000..0c58f16
--- /dev/null
+++ b/openwire-core/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java
@@ -0,0 +1,107 @@
+/**
+ * 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.DataStructure;
+import org.apache.activemq.openwire.commands.LastPartialCommand;
+
+public class LastPartialCommandMarshaller extends PartialCommandMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ *
+ * @return short representation of the type data structure
+ */
+ @Override
+ public byte getDataStructureType() {
+ return LastPartialCommand.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ @Override
+ public DataStructure createObject() {
+ return new LastPartialCommand();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ int rc = super.tightMarshal1(wireFormat, o, 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ @Override
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
+ super.looseMarshal(wireFormat, o, dataOut);
+ }
+}