http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/LastPartialCommandMarshaller.java new file mode 100644 index 0000000..0c58f16 --- /dev/null +++ b/openwire-legacy/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); + } +}
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/LocalTransactionIdMarshaller.java new file mode 100644 index 0000000..0331e6b --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MarshallerFactory.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MarshallerFactory.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MarshallerFactory.java new file mode 100644 index 0000000..e170e80 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java new file mode 100644 index 0000000..8a44894 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchMarshaller.java new file mode 100644 index 0000000..e283152 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageDispatchNotificationMarshaller.java new file mode 100644 index 0000000..ec9939e --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageIdMarshaller.java new file mode 100644 index 0000000..3b0448d --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageMarshaller.java new file mode 100644 index 0000000..4382431 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/NetworkBridgeFilterMarshaller.java new file mode 100644 index 0000000..a917b72 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireBytesMessageMarshaller.java new file mode 100644 index 0000000..147432b --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireDestinationMarshaller.java new file mode 100644 index 0000000..5e76809 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMapMessageMarshaller.java new file mode 100644 index 0000000..2d7802a --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireMessageMarshaller.java new file mode 100644 index 0000000..362e5af --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireObjectMessageMarshaller.java new file mode 100644 index 0000000..599755a --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/OpenWireQueueMarshaller.java new file mode 100644 index 0000000..32cd878 --- /dev/null +++ b/openwire-legacy/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); + } +}
