You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/11/16 23:13:05 UTC

svn commit: r1035835 - /activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/

Author: tabish
Date: Tue Nov 16 22:13:04 2010
New Revision: 1035835

URL: http://svn.apache.org/viewvc?rev=1035835&view=rev
Log:
Updates so that Commands can extend other interfaces, makes the XATransactionId extend Xid now so that they can be returned from a recover call to the XAResource.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdSourceGenerator.java   (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandCodeGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandHeaderGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConnectionIdSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConsumerIdSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageHeaderGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdHeaderGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ProducerIdSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdHeaderGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoHeaderGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoSourceGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdHeaderGenerator.java

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandCodeGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandCodeGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandCodeGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandCodeGenerator.java Tue Nov 16 22:13:04 2010
@@ -32,6 +32,7 @@ public abstract class CommandCodeGenerat
     private String className;
     private String baseClassName;
     private Set<String> includeFiles = new TreeSet<String>();
+    private Set<String> baseClasses = new TreeSet<String>();
     private String openWireOpCode;
     private boolean comparable = false;
     private boolean assignable = false;
@@ -131,6 +132,14 @@ public abstract class CommandCodeGenerat
         this.includeFiles = includeFiles;
     }
 
+    public Set<String> getBaseClasses() {
+        return baseClasses;
+    }
+
+    public void setBaseClasses(Set<String> baseClasses) {
+        this.baseClasses = baseClasses;
+    }
+
     public String getOpenWireOpCode() {
         return openWireOpCode;
     }

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandHeaderGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandHeaderGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandHeaderGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandHeaderGenerator.java Tue Nov 16 22:13:04 2010
@@ -17,6 +17,7 @@
 package org.apache.activemq.openwire.tool.commands;
 
 import java.io.PrintWriter;
+import java.util.Iterator;
 import java.util.Set;
 
 import org.codehaus.jam.JProperty;
@@ -28,6 +29,9 @@ public class CommandHeaderGenerator exte
         // Start with the license.
         generateLicence(out);
 
+        populateIncludeFilesSet();
+        populateBaseClassesSet();
+
         out.println("#ifndef _ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_");
         out.println("#define _ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_");
         out.println("");
@@ -37,7 +41,6 @@ public class CommandHeaderGenerator exte
         out.println("#endif");
         out.println("");
 
-        populateIncludeFilesSet();
         for( String include : getIncludeFiles() ) {
             if( include != null ) {
                 out.println("#include "+include);
@@ -165,6 +168,15 @@ public class CommandHeaderGenerator exte
         }
     }
 
+    protected void populateBaseClassesSet() {
+        Set<String> classes = getBaseClasses();
+        classes.add(getBaseClassName());
+
+        if( isComparable() ) {
+            classes.add("decaf::lang::Comparable<"+getClassName()+">");
+        }
+    }
+
     protected void generateNamespaceWrapper( PrintWriter out ) {
         out.println("namespace activemq{");
         out.println("namespace commands{");
@@ -177,11 +189,14 @@ public class CommandHeaderGenerator exte
     protected void generateClassDefinition( PrintWriter out ) {
         out.print("    class AMQCPP_API "+getClassName()+" : " );
 
-        if( isComparable() ) {
-            out.println("public "+ getBaseClassName() +", public decaf::lang::Comparable<"+getClassName()+"> {" );
-        } else {
-            out.print("public "+ getBaseClassName() +" {" );
-            out.println("");
+        Iterator<String> iter = this.getBaseClasses().iterator();
+        while(iter.hasNext()) {
+            out.print("public " + iter.next());
+            if( iter.hasNext() ) {
+                out.print(", ");
+            } else {
+                out.println(" {");
+            }
         }
     }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/CommandSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -17,6 +17,7 @@
 package org.apache.activemq.openwire.tool.commands;
 
 import java.io.PrintWriter;
+import java.util.Iterator;
 import java.util.Set;
 
 import org.codehaus.jam.JProperty;
@@ -28,6 +29,7 @@ public class CommandSourceGenerator exte
         // Start with the license.
         generateLicence(out);
 
+        populateBaseClassesSet();
         populateIncludeFilesSet();
         for( String include : getIncludeFiles() ) {
             if( include != null ) {
@@ -54,7 +56,7 @@ public class CommandSourceGenerator exte
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println(""+getClassName()+"::"+getClassName()+"() " );
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         generateDefaultConstructorBody(out);
         out.println("}");
@@ -62,7 +64,7 @@ public class CommandSourceGenerator exte
         if( isAssignable() ) {
             out.println("////////////////////////////////////////////////////////////////////////////////");
             out.println(""+getClassName()+"::"+getClassName()+"( const "+getClassName()+"& other )");
-            out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+            out.println("    : " + generateInitializerList() + " {");
             out.println("");
             out.println("    this->copyDataStructure( &other );");
             out.println("}");
@@ -151,7 +153,7 @@ public class CommandSourceGenerator exte
             out.println("");
             out.println("////////////////////////////////////////////////////////////////////////////////");
             out.println("bool " + getClassName() + "::equals( const "+getClassName()+"& value ) const {");
-            out.println("    return this->equals( &value );");
+            out.println("    return this->equals( (const DataStructure*)&value );");
             out.println("}");
             out.println("");
             out.println("////////////////////////////////////////////////////////////////////////////////");
@@ -197,18 +199,29 @@ public class CommandSourceGenerator exte
         }
     }
 
+    protected void populateBaseClassesSet() {
+        Set<String> classes = getBaseClasses();
+        classes.add(getBaseClassName());
+    }
+
     protected void generateDefaultConstructorBody( PrintWriter out ) {
     }
 
-    protected String generateInitializerList(String current) {
+    protected String generateInitializerList() {
 
         StringBuilder result = new StringBuilder();
-        int lastLineEnds = 0;
 
-        if( current != null ) {
-            result.append(current);
+        Iterator<String> iter = getBaseClasses().iterator();
+        while(iter.hasNext()) {
+            result.append(iter.next());
+            result.append("()");
+
+            if(iter.hasNext()) {
+                result.append(", ");
+            }
         }
 
+        int lastLineEnds = 0;
         for( JProperty property : getProperties() ) {
             String type = toCppType(property.getType());
             String value = toCppDefaultValue(property.getType());

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConnectionIdSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConnectionIdSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConnectionIdSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConnectionIdSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -33,21 +33,21 @@ public class ConnectionIdSourceGenerator
     protected void generateAdditionalConstructors( PrintWriter out ) {
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("ConnectionId::ConnectionId( const SessionId* sessionId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->value = sessionId->getConnectionId();");
         out.println("}");
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("ConnectionId::ConnectionId( const ProducerId* producerId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->value = producerId->getConnectionId();");
         out.println("}");
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("ConnectionId::ConnectionId( const ConsumerId* consumerId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->value = consumerId->getConnectionId();");
         out.println("}");

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConsumerIdSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConsumerIdSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConsumerIdSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ConsumerIdSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -25,7 +25,7 @@ public class ConsumerIdSourceGenerator e
 
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("ConsumerId::ConsumerId( const SessionId& sessionId, long long consumerIdd )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->connectionId = sessionId.getConnectionId();");
         out.println("    this->sessionId = sessionId.getValue();");
@@ -37,14 +37,7 @@ public class ConsumerIdSourceGenerator e
     }
 
     protected String generateInitializerList(String current) {
-        StringBuilder result = new StringBuilder();
-
-        if( current != null ){
-            result.append(current);
-        }
-        result.append(", parentId()");
-
-        return super.generateInitializerList(result.toString());
+        return super.generateInitializerList() + ", parentId()";
     }
 
     protected void generateAdditionalMethods( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageHeaderGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageHeaderGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageHeaderGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageHeaderGenerator.java Tue Nov 16 22:13:04 2010
@@ -42,6 +42,8 @@ public class MessageHeaderGenerator exte
 
     protected void generateProperties( PrintWriter out ) {
 
+        super.generateProperties( out );
+
         out.println("    private:");
         out.println("");
         out.println("        // Used to allow a client to call Message::acknowledge when in the Client");
@@ -64,8 +66,6 @@ public class MessageHeaderGenerator exte
         out.println("");
         out.println("        static const unsigned int DEFAULT_MESSAGE_SIZE = 1024;");
         out.println("");
-
-        super.generateProperties( out );
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdHeaderGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdHeaderGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdHeaderGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdHeaderGenerator.java Tue Nov 16 22:13:04 2010
@@ -45,12 +45,12 @@ public class MessageIdHeaderGenerator ex
 
     protected void generateProperties( PrintWriter out ) {
 
+        super.generateProperties(out);
+
         out.println("    private:");
         out.println("");
         out.println("        mutable std::string key;");
         out.println("");
-
-        super.generateProperties(out);
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageIdSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -25,14 +25,14 @@ public class MessageIdSourceGenerator ex
 
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("MessageId::MessageId( const std::string& messageKey )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->setValue( messageKey );");
         out.println("}");
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("MessageId::MessageId( const Pointer<ProducerInfo>& producerInfo, long long producerSequenceId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->producerId = producerInfo->getProducerId();");
         out.println("    this->producerSequenceId = producerSequenceId;");
@@ -40,7 +40,7 @@ public class MessageIdSourceGenerator ex
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("MessageId::MessageId( const Pointer<ProducerId>& producerId, long long producerSequenceId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->producerId = producerId;");
         out.println("    this->producerSequenceId = producerSequenceId;");
@@ -48,7 +48,7 @@ public class MessageIdSourceGenerator ex
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("MessageId::MessageId( const std::string& producerId, long long producerSequenceId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->producerId.reset( new ProducerId( producerId ) );");
         out.println("    this->producerSequenceId = producerSequenceId;");
@@ -58,15 +58,8 @@ public class MessageIdSourceGenerator ex
         super.generateAdditionalConstructors(out);
     }
 
-    protected String generateInitializerList(String current) {
-        StringBuilder result = new StringBuilder();
-
-        if( current != null ){
-            result.append(current);
-        }
-        result.append(", key(\"\")");
-
-        return super.generateInitializerList(result.toString());
+    protected String generateInitializerList() {
+        return super.generateInitializerList() + ", key(\"\")";
     }
 
     protected void generateAdditionalMethods( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/MessageSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -31,19 +31,17 @@ public class MessageSourceGenerator exte
         includes.add("<decaf/lang/System.h>");
     }
 
-    protected String generateInitializerList(String current) {
+    protected String generateInitializerList() {
         StringBuilder result = new StringBuilder();
 
-        if( current != null ){
-            result.append(current);
-        }
+        result.append(super.generateInitializerList());
         result.append(", ackHandler(NULL)");
         result.append(", properties()");
         result.append(", readOnlyProperties(false)");
         result.append(", readOnlyBody(false)");
         result.append(", connection(NULL)");
 
-        return super.generateInitializerList(result.toString());
+        return result.toString();
     }
 
     protected void generateCopyDataStructureBody( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ProducerIdSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ProducerIdSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ProducerIdSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/ProducerIdSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -25,7 +25,7 @@ public class ProducerIdSourceGenerator e
 
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("ProducerId::ProducerId( const SessionId& sessionId, long long consumerId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->connectionId = sessionId.getConnectionId();");
         out.println("    this->sessionId = sessionId.getValue();");
@@ -34,7 +34,7 @@ public class ProducerIdSourceGenerator e
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("ProducerId::ProducerId( std::string producerKey )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    // Parse off the producerId");
         out.println("    std::size_t p = producerKey.rfind( ':' );");
@@ -52,14 +52,7 @@ public class ProducerIdSourceGenerator e
     }
 
     protected String generateInitializerList(String current) {
-        StringBuilder result = new StringBuilder();
-
-        if( current != null ){
-            result.append(current);
-        }
-        result.append(", parentId()");
-
-        return super.generateInitializerList(result.toString());
+        return super.generateInitializerList() + ", parentId()";
     }
 
     protected void generateAdditionalMethods( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdHeaderGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdHeaderGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdHeaderGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdHeaderGenerator.java Tue Nov 16 22:13:04 2010
@@ -48,12 +48,12 @@ public class SessionIdHeaderGenerator ex
 
     protected void generateProperties( PrintWriter out ) {
 
+        super.generateProperties(out);
+
         out.println("    private:");
         out.println("");
         out.println("        mutable Pointer<ConnectionId> parentId;");
         out.println("");
-
-        super.generateProperties(out);
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionIdSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -39,22 +39,15 @@ public class SessionIdSourceGenerator ex
         out.println("    return stream.str();");
     }
 
-    protected String generateInitializerList(String current) {
-        StringBuilder result = new StringBuilder();
-
-        if( current != null ){
-            result.append(current);
-        }
-        result.append(", parentId()");
-
-        return super.generateInitializerList(result.toString());
+    protected String generateInitializerList() {
+        return super.generateInitializerList() + ", parentId()";
     }
 
     protected void generateAdditionalConstructors( PrintWriter out ) {
 
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("SessionId::SessionId( const ConnectionId* connectionId, long long sessionId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->connectionId = connectionId->getValue();");
         out.println("    this->value = sessionId;");
@@ -62,7 +55,7 @@ public class SessionIdSourceGenerator ex
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("SessionId::SessionId( const ProducerId* producerId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->connectionId = producerId->getConnectionId();");
         out.println("    this->value = producerId->getSessionId();");
@@ -70,7 +63,7 @@ public class SessionIdSourceGenerator ex
         out.println("");
         out.println("////////////////////////////////////////////////////////////////////////////////");
         out.println("SessionId::SessionId( const ConsumerId* consumerId )");
-        out.println("    : " + generateInitializerList(getBaseClassName() + "()") + " {");
+        out.println("    : " + generateInitializerList() + " {");
         out.println("");
         out.println("    this->connectionId = consumerId->getConnectionId();");
         out.println("    this->value = consumerId->getSessionId();");

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoHeaderGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoHeaderGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoHeaderGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoHeaderGenerator.java Tue Nov 16 22:13:04 2010
@@ -31,13 +31,13 @@ public class SessionInfoHeaderGenerator 
 
     protected void generateProperties( PrintWriter out ) {
 
+        super.generateProperties(out);
+
         out.println("    private:");
         out.println("");
         out.println("        // The ACK mode that the Session was created with" );
         out.println("        unsigned int ackMode;");
         out.println("");
-
-        super.generateProperties(out);
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoSourceGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoSourceGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/SessionInfoSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -29,15 +29,8 @@ public class SessionInfoSourceGenerator 
         super.populateIncludeFilesSet();
     }
 
-    protected String generateInitializerList(String current) {
-        StringBuilder result = new StringBuilder();
-
-        if( current != null ){
-            result.append(current);
-        }
-        result.append(", ackMode((unsigned int)cms::Session::AUTO_ACKNOWLEDGE)");
-
-        return super.generateInitializerList(result.toString());
+    protected String generateInitializerList() {
+        return super.generateInitializerList() + ", ackMode((unsigned int)cms::Session::AUTO_ACKNOWLEDGE)";
     }
 
     protected void generateAdditionalMethods( PrintWriter out ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdHeaderGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdHeaderGenerator.java?rev=1035835&r1=1035834&r2=1035835&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdHeaderGenerator.java (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdHeaderGenerator.java Tue Nov 16 22:13:04 2010
@@ -17,15 +17,47 @@
 package org.apache.activemq.openwire.tool.commands;
 
 import java.io.PrintWriter;
+import java.util.Set;
 
 public class XATransactionIdHeaderGenerator extends CommandHeaderGenerator {
 
+    protected void populateIncludeFilesSet() {
+        Set<String> includes = getIncludeFiles();
+        includes.add("<cms/Xid.h>");
+
+        super.populateIncludeFilesSet();
+    }
+
+    protected void generateAdditionalConstructors( PrintWriter out ) {
+        out.println("        "+getClassName()+"( const cms::Xid* xid );");
+        out.println("");
+
+        super.generateAdditionalConstructors(out);
+    }
+
+    protected void populateBaseClassesSet() {
+        super.populateBaseClassesSet();
+        Set<String> classes = getBaseClasses();
+        classes.add("cms::Xid");
+    }
+
     protected void generateAdditonalMembers( PrintWriter out ) {
         out.println("        virtual bool isXATransactionId() const {");
         out.println("            return true;");
         out.println("        }");
         out.println("");
 
+        out.println("    public:  // Xid interface implementation.");
+        out.println("");
+        out.println("        virtual Xid* clone() const;");
+        out.println("");
+        out.println("        virtual bool equals( const Xid* other ) const;");
+        out.println("");
+        out.println("        virtual int getBranchQualifier( unsigned char* buffer, int size ) const;");
+        out.println("");
+        out.println("        virtual int getGlobalTransactionId( unsigned char* buffer, int size ) const;");
+        out.println("");
+
         super.generateAdditonalMembers( out );
     }
 }

Added: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdSourceGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdSourceGenerator.java?rev=1035835&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdSourceGenerator.java (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdSourceGenerator.java Tue Nov 16 22:13:04 2010
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.openwire.tool.commands;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+public class XATransactionIdSourceGenerator extends CommandSourceGenerator {
+
+    protected void generateAdditionalConstructors( PrintWriter out ) {
+
+        out.println("////////////////////////////////////////////////////////////////////////////////");
+        out.println("XATransactionId::XATransactionId( const cms::Xid* xid )");
+        out.println("    : " + generateInitializerList() + " {");
+        out.println("");
+        out.println("    if( xid == NULL ) {");
+        out.println("        return;");
+        out.println("    }");
+        out.println("");
+        out.println("    this->formatId = xid->getFormatId();");
+        out.println("    this->branchQualifier.resize( cms::Xid::MAXBQUALSIZE );");
+        out.println("    this->globalTransactionId.resize( cms::Xid::MAXGTRIDSIZE );");
+        out.println("");
+        out.println("    int result = xid->getBranchQualifier( &this->branchQualifier[0], cms::Xid::MAXBQUALSIZE );");
+        out.println("");
+        out.println("    if( result == -1 ) {");
+        out.println("        throw cms::XAException(\"Invalid Xid Branch Qualifier is larger than MAXBQUALSIZE\" );");
+        out.println("    } else {");
+        out.println("        this->branchQualifier.resize( result );");
+        out.println("    }");
+        out.println("");
+        out.println("    result = xid->getGlobalTransactionId( &this->globalTransactionId[0], cms::Xid::MAXGTRIDSIZE );");
+        out.println("");
+        out.println("    if( result == -1 ) {");
+        out.println("        throw cms::XAException(\"Invalid Xid Global Transaction Id is larger than MAXGTRIDSIZE\" );");
+        out.println("    } else {");
+        out.println("        this->globalTransactionId.resize( result );");
+        out.println("    }");
+        out.println("}");
+        out.println("");
+
+        super.generateAdditionalConstructors(out);
+    }
+
+    protected void populateIncludeFilesSet() {
+
+        super.populateIncludeFilesSet();
+
+        Set<String> includes = getIncludeFiles();
+        includes.add("<cms/XAException.h>");
+    }
+
+    protected void populateBaseClassesSet() {
+        super.populateBaseClassesSet();
+        Set<String> classes = getBaseClasses();
+        classes.add("cms::Xid");
+    }
+
+    protected void generateAdditionalMethods( PrintWriter out ) {
+        out.println("////////////////////////////////////////////////////////////////////////////////");
+        out.println("cms::Xid* XATransactionId::clone() const {");
+        out.println("");
+        out.println("    XATransactionId* theClone = new XATransactionId();");
+        out.println("");
+        out.println("    theClone->formatId = this->formatId;");
+        out.println("    theClone->globalTransactionId = this->globalTransactionId;");
+        out.println("    theClone->branchQualifier = this->branchQualifier;");
+        out.println("");
+        out.println("    return theClone;");
+        out.println("}");
+        out.println("");
+        out.println("////////////////////////////////////////////////////////////////////////////////");
+        out.println("bool XATransactionId::equals( const cms::Xid* other ) const {");
+        out.println("");
+        out.println("    if( (void*)this == other ) {");
+        out.println("        return true;");
+        out.println("    }");
+        out.println("");
+        out.println("    if( other == NULL ) {");
+        out.println("        return false;");
+        out.println("    }");
+        out.println("");
+        out.println("    if( this->formatId != other->getFormatId() ) {");
+        out.println("        return false;");
+        out.println("    }");
+        out.println("");
+        out.println("    std::vector<unsigned char> otherBQual( Xid::MAXBQUALSIZE );");
+        out.println("");
+        out.println("    other->getBranchQualifier( &otherBQual[0], Xid::MAXBQUALSIZE );");
+        out.println("");
+        out.println("    if( this->branchQualifier != otherBQual ) {");
+        out.println("        return false;");
+        out.println("    }");
+        out.println("");
+        out.println("    std::vector<unsigned char> otherGTXID( Xid::MAXBQUALSIZE );");
+        out.println("");
+        out.println("    other->getGlobalTransactionId( &otherGTXID[0], Xid::MAXGTRIDSIZE );");
+        out.println("");
+        out.println("    if( this->globalTransactionId != otherGTXID ) {");
+        out.println("        return false;");
+        out.println("    }");
+        out.println("");
+        out.println("    return true;");
+        out.println("}");
+        out.println("");
+        out.println("////////////////////////////////////////////////////////////////////////////////");
+        out.println("int XATransactionId::getBranchQualifier( unsigned char* buffer, int size ) const {");
+        out.println("");
+        out.println("    if( size < 0 ) {");
+        out.println("        throw cms::XAException(\"Invalid negative size value passed to getBranchQualifier()\");");
+        out.println("    }");
+        out.println("");
+        out.println("    if( size < (int)this->branchQualifier.size() ) {");
+        out.println("        return -1;");
+        out.println("    }");
+        out.println("");
+        out.println("    if( this->branchQualifier.size() == 0 ) {");
+        out.println("        return 0;");
+        out.println("    }");
+        out.println("");
+        out.println("    std::copy( this->branchQualifier.begin(), this->branchQualifier.end(), buffer );");
+        out.println("");
+        out.println("    return (int)this->branchQualifier.size();");
+        out.println("}");
+        out.println("");
+        out.println("////////////////////////////////////////////////////////////////////////////////");
+        out.println("int XATransactionId::getGlobalTransactionId( unsigned char* buffer, int size ) const {");
+        out.println("");
+        out.println("    if( size < 0 ) {");
+        out.println("        throw cms::XAException(\"Invalid negative size value passed to getGlobalTransactionId()\");");
+        out.println("    }");
+        out.println("");
+        out.println("    if( size < (int)this->globalTransactionId.size() ) {");
+        out.println("        return -1;");
+        out.println("    }");
+        out.println("");
+        out.println("    if( this->globalTransactionId.size() == 0 ) {");
+        out.println("        return 0;");
+        out.println("    }");
+        out.println("");
+        out.println("    std::copy( this->globalTransactionId.begin(), this->globalTransactionId.end(), buffer );");
+        out.println("");
+        out.println("    return (int)this->globalTransactionId.size();");
+        out.println("}");
+        out.println("");
+
+        super.generateAdditionalMethods(out);
+    }
+
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/commands/XATransactionIdSourceGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native