Skip to content
Permalink
Browse files
https://issues.apache.org/jira/browse/AMQNET-444
Update to generate v10
  • Loading branch information
Timothy A. Bish committed Oct 2, 2013
1 parent eacd441 commit a70bb8ac24a8aa2a846a832f91e276eb8a3c30a8
Showing 4 changed files with 64 additions and 14 deletions.
10 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>
@@ -59,7 +59,21 @@ protected void generateToStringBody( PrintWriter out ) {

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;");
@@ -25,21 +25,21 @@ protected void generateVisitBody( PrintWriter out ) {
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(" }");
@@ -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) + \" ]\";");
}

}

0 comments on commit a70bb8a

Please sign in to comment.