Repository: activemq-openwire Updated Branches: refs/heads/master 1705e0ed7 -> 0c90d2e3d
http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/TransactionInfoMarshaller.java new file mode 100644 index 0000000..901eac7 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/WireFormatInfoMarshaller.java new file mode 100644 index 0000000..ed1db10 --- /dev/null +++ b/openwire-legacy/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/0c90d2e3/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java ---------------------------------------------------------------------- diff --git a/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java b/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v9/XATransactionIdMarshaller.java new file mode 100644 index 0000000..2a64979 --- /dev/null +++ b/openwire-legacy/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); + } +} http://git-wip-us.apache.org/repos/asf/activemq-openwire/blob/0c90d2e3/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 8171a6e..5135a68 100644 --- a/pom.xml +++ b/pom.xml @@ -38,14 +38,17 @@ <target-version>1.7</target-version> <!-- Dependency Versions for this Project --> + <ant-version>1.9.6</ant-version> <junit-version>4.12</junit-version> - <slf4j-version>1.7.12</slf4j-version> + <slf4j-version>1.7.13</slf4j-version> <hawtbuf-version>1.11</hawtbuf-version> <activemq-version>5.12.1</activemq-version> <jetty-version>8.1.15.v20140411</jetty-version> <mockito-version>1.10.19</mockito-version> + <reflections-version>0.9.10</reflections-version> <!-- Maven Plugin Version for this Project --> + <maven-antrun-plugin-version>1.3</maven-antrun-plugin-version> <maven-surefire-plugin-version>2.18.1</maven-surefire-plugin-version> <maven-assembly-plugin-version>2.4</maven-assembly-plugin-version> <maven-release-plugin-version>2.4.1</maven-release-plugin-version> @@ -109,21 +112,20 @@ <module>openwire-legacy</module> <module>openwire-interop-tests</module> <module>openwire-website</module> + <module>openwire-annotations</module> </modules> <dependencyManagement> <dependencies> <dependency> <groupId>org.apache.activemq</groupId> - <artifactId>openwire-core</artifactId> + <artifactId>openwire-annotations</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>openwire-core</artifactId> <version>${project.version}</version> - <scope>test</scope> - <type>test-jar</type> </dependency> <dependency> <groupId>org.apache.activemq</groupId> @@ -137,6 +139,11 @@ </dependency> <dependency> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> + <version>${reflections-version}</version> + </dependency> + <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-jms_1.1_spec</artifactId> <version>1.1.1</version> @@ -148,10 +155,10 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> <version>${mockito-version}</version> - <scope>test</scope> + <scope>test</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> @@ -169,6 +176,11 @@ <version>${hawtbuf-version}</version> </dependency> <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>${ant-version}</version> + </dependency> + <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>${maven-antrun-plugin-version}</version> @@ -215,6 +227,11 @@ <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin-version}</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>${maven-antrun-plugin-version}</version> + </plugin> </plugins> </pluginManagement> <plugins>
