This is an automated email from the ASF dual-hosted git repository. dfoulks pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-nms-openwire-generator.git
commit a70bb8ac24a8aa2a846a832f91e276eb8a3c30a8 Author: Timothy A. Bish <[email protected]> AuthorDate: Wed Oct 2 17:42:08 2013 +0000 https://issues.apache.org/jira/browse/AMQNET-444 Update to generate v10 --- pom.xml | 10 +++--- .../openwire/tool/commands/MessageIdGenerator.java | 16 +++++++++- .../tool/commands/TransactionInfoGenerator.java | 16 +++++----- .../tool/commands/XATransactionIdGenerator.java | 36 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 180bba8..88930e1 100644 --- a/pom.xml +++ b/pom.xml @@ -65,8 +65,8 @@ <projectName>Apache NMS.ActiveMQ</projectName> <annogen-version>0.1.0</annogen-version> <ant-version>1.6.2</ant-version> - <xstream-version>1.4.2</xstream-version> - <activemq-core-dir>${ACTIVEMQ_SRC_HOME}/activemq-client/</activemq-core-dir> + <xstream-version>1.4.4</xstream-version> + <activemq-src-dir>${ACTIVEMQ_SRC_HOME}/activemq-client/</activemq-src-dir> <nms-activemq-dir>${NMS_ACTIVEMQ_HOME}</nms-activemq-dir> </properties> @@ -128,8 +128,8 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <source>1.5</source> - <target>1.5</target> + <source>1.6</source> + <target>1.6</target> </configuration> </plugin> <plugin> @@ -139,7 +139,7 @@ <tasks> <echo>Running OpenWire Generator</echo> <taskdef name="generate" classname="org.apache.activemq.nms.openwire.tool.AmqCSharpGeneratorTask" classpathref="maven.compile.classpath" /> - <generate maxVersion="9" source="${activemq-core-dir}" target="${nms-activemq-dir}" /> + <generate maxVersion="10" source="${activemq-src-dir}" target="${nms-activemq-dir}" /> </tasks> </configuration> </plugin> diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageIdGenerator.java index 6b256db..d3ffabf 100644 --- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageIdGenerator.java +++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageIdGenerator.java @@ -59,7 +59,21 @@ public class MessageIdGenerator extends CommandClassGenerator { out.println(" if(key == null) "); out.println(" {"); - out.println(" key = producerId.ToString() + \":\" + producerSequenceId + \":\" + brokerSequenceId;"); + out.println(" if (!String.IsNullOrEmpty(textView))"); + out.println(" {"); + out.println(" if (textView.StartsWith(\"ID:\"))"); + out.println(" {"); + out.println(" key = textView;"); + out.println(" }"); + out.println(" else"); + out.println(" {"); + out.println(" key = \"ID:\" + textView;"); + out.println(" }"); + out.println(" }"); + out.println(" else"); + out.println(" {"); + out.println(" key = producerId.ToString() + \":\" + producerSequenceId + \":\" + brokerSequenceId;"); + out.println(" }"); out.println(" }"); out.println(" "); out.println(" return key;"); diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/TransactionInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/TransactionInfoGenerator.java index 025a68c..badd057 100644 --- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/TransactionInfoGenerator.java +++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/TransactionInfoGenerator.java @@ -25,21 +25,21 @@ public class TransactionInfoGenerator extends CommandClassGenerator { out.println(" switch(type)"); out.println(" {"); out.println(" case TransactionInfo.BEGIN:"); - out.println(" return visitor.processBeginTransaction(this);"); + out.println(" return visitor.ProcessBeginTransaction(this);"); out.println(" case TransactionInfo.END:"); - out.println(" return visitor.processEndTransaction(this);"); + out.println(" return visitor.ProcessEndTransaction(this);"); out.println(" case TransactionInfo.PREPARE:"); - out.println(" return visitor.processPrepareTransaction(this);"); + out.println(" return visitor.ProcessPrepareTransaction(this);"); out.println(" case TransactionInfo.COMMIT_ONE_PHASE:"); - out.println(" return visitor.processCommitTransactionOnePhase(this);"); + out.println(" return visitor.ProcessCommitTransactionOnePhase(this);"); out.println(" case TransactionInfo.COMMIT_TWO_PHASE:"); - out.println(" return visitor.processCommitTransactionTwoPhase(this);"); + out.println(" return visitor.ProcessCommitTransactionTwoPhase(this);"); out.println(" case TransactionInfo.ROLLBACK:"); - out.println(" return visitor.processRollbackTransaction(this);"); + out.println(" return visitor.ProcessRollbackTransaction(this);"); out.println(" case TransactionInfo.RECOVER:"); - out.println(" return visitor.processRecoverTransactions(this);"); + out.println(" return visitor.ProcessRecoverTransactions(this);"); out.println(" case TransactionInfo.FORGET:"); - out.println(" return visitor.processForgetTransaction(this);"); + out.println(" return visitor.ProcessForgetTransaction(this);"); out.println(" default:"); out.println(" throw new IOException(\"Transaction info type unknown: \" + type);"); out.println(" }"); diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/XATransactionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/XATransactionIdGenerator.java new file mode 100644 index 0000000..2b35cb7 --- /dev/null +++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/XATransactionIdGenerator.java @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.nms.openwire.tool.commands; + +import java.io.PrintWriter; + +public class XATransactionIdGenerator extends CommandClassGenerator { + + protected void generateUsingDirectives( PrintWriter out ) { + super.generateUsingDirectives(out); + + out.println("using System;"); + } + + protected void generateToStringBody( PrintWriter out ) { + out.println(" return GetType().Name + \"[ \" +"); + out.println(" \"FormatId = \" + FormatId + \", \" +"); + out.println(" \"GlobalTransactionId = \" + BitConverter.ToString(GlobalTransactionId).Replace(\"-\", string.Empty) + \", \" +"); + out.println(" \"BranchQualifier = \" + System.Text.ASCIIEncoding.ASCII.GetString(BranchQualifier) + \" ]\";"); + } + +}
