You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by df...@apache.org on 2021/04/09 20:12:05 UTC

[activemq-nms-openwire-generator] branch main created (now d16ff37)

This is an automated email from the ASF dual-hosted git repository.

dfoulks pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-openwire-generator.git.


      at d16ff37  AMQNET-562 Update NOTICE file

This branch includes the following new commits:

     new aec40e9  Rename to reflect other project names
     new 3a91f10  Populate with the initial generators work, not complete.
     new 77ddbd7  Init the SVN Ignore properties.
     new c31b80e  First workable version of Command Class generation.  Needs more work now to implement specific Commands that require special methods and extensions.
     new 3b257ca  Commands Generator, produces CSharp Openwire Command classes with mostly all the same functionality as the older hand hacked ones, plus all the correct Openwire Protocol values for v1-v5
     new 6fb6566  Marshaler class generation now works, and some fixes to Command generation.
     new 80da5b3  Cleans up the generated code a bit to match the existing coding conventions.
     new cf517b8  Cleans up the generated code a bit to match the existing coding conventions.
     new 3f3aab4  Adds some more local properties to the Message command.
     new 8bdbfa5  https://issues.apache.org/activemq/browse/AMQNET-162
     new 3ae3b39  https://issues.apache.org/activemq/browse/AMQNET-193
     new d746747  https://issues.apache.org/activemq/browse/AMQNET-193
     new 6787e10  Update to add an attempt at the IsExpired method needed in Message
     new cd5d8bf  https://issues.apache.org/activemq/browse/AMQNET-176
     new e5b5b32  Update the .NET generator to generate an equals method for the MessageDispatch command.
     new 33428d8  Clean up the generated to String methods for the commands to make the logging easier to read.
     new 2ad3b98  Further refine the output of ToString.
     new cae624d  Add generator for BrokerId to customize the ToString method.
     new 569714f  Includes the broker sequence Id into the ToString output.
     new 2ede2c6  https://issues.apache.org/activemq/browse/AMQNET-246 Fix the generated code to use correct interfaces.
     new a6e0662  Update NMS Openwire Generator pom to use 5.4-SNAPSHOT.
     new 636543c  Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
     new 39165ed  Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
     new 83c9843  Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
     new 2070215  Updates the generator for some things needed in: https://issues.apache.org/jira/browse/AMQNET-290
     new 558fc0d  Fix for possible NPE in generated code.
     new b78d698  fix for: https://issues.apache.org/jira/browse/AMQNET-427
     new 0e8f216  Add a transient Exception field in MessageDispatch to store the Rollback cause.
     new eacd441  Generator updates to clean some code.
     new a70bb8a  https://issues.apache.org/jira/browse/AMQNET-444
     new 053156b  Update project to allow for generating new versions of some commands.
     new d16ff37  AMQNET-562 Update NOTICE file

The 32 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[activemq-nms-openwire-generator] 07/32: Cleans up the generated code a bit to match the existing coding conventions.

Posted by df...@apache.org.
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 80da5b3dcfddaef0450ab5dd9f1b877d540b290a
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Jul 30 15:32:31 2009 +0000

    Cleans up the generated code a bit to match the existing coding conventions.
---
 .../nms/openwire/tool/commands/CommandClassGenerator.java      | 10 ++++++----
 .../nms/openwire/tool/commands/ConsumerIdGenerator.java        |  6 ++++--
 .../nms/openwire/tool/commands/ProducerIdGenerator.java        |  6 ++++--
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 40386eb..89d0aee 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -55,11 +55,8 @@ public class CommandClassGenerator extends CommandCodeGenerator {
 
         generateProperties( out );
 
-        out.println("");
-
         generateConstructors(out);
 
-        out.println("");
         out.println("        ///");
         out.println("        /// <summery>");
         out.println("        ///  Get the unique identifier that this object and its own");
@@ -155,7 +152,6 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         }
 
         out.println("    };");
-        out.println("");
         out.println("}");
         out.println("");
     }
@@ -187,12 +183,18 @@ public class CommandClassGenerator extends CommandCodeGenerator {
 
     protected void generateProperties( PrintWriter out ) {
 
+        if( getProperties().isEmpty() ) {
+            return;
+        }
+
         for( JProperty property : getProperties() ) {
             String type = toCSharpType(property.getType());
             String name = decapitalize(property.getSimpleName());
 
             out.println("        "+type+" "+name+";");
         }
+
+        out.println("");
     }
 
     protected void generateVisitBody( PrintWriter out ) {
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
index 396a85c..dd0f666 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
@@ -22,10 +22,12 @@ public class ConsumerIdGenerator extends CommandClassGenerator {
 
     protected void generateConstructors( PrintWriter out ) {
 
-        out.println("        public "+getClassName()+"() {");
+        out.println("        public "+getClassName()+"()");
+        out.println("        {");
         out.println("        }");
         out.println("");
-        out.println("        public "+getClassName()+"( SessionId sessionId, long consumerId ) {");
+        out.println("        public "+getClassName()+"( SessionId sessionId, long consumerId )");
+        out.println("        {");
         out.println("            this.connectionId = sessionId.ConnectionId;");
         out.println("            this.sessionId = sessionId.Value;");
         out.println("            this.value = consumerId;");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
index c42817a..46db0eb 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
@@ -22,10 +22,12 @@ public class ProducerIdGenerator extends CommandClassGenerator {
 
     protected void generateConstructors( PrintWriter out ) {
 
-        out.println("        public "+getClassName()+"() {");
+        out.println("        public "+getClassName()+"()");
+        out.println("        {");
         out.println("        }");
         out.println("");
-        out.println("        public "+getClassName()+"( SessionId sessionId, long consumerId ) {");
+        out.println("        public "+getClassName()+"( SessionId sessionId, long consumerId )");
+        out.println("        {");
         out.println("            this.connectionId = sessionId.ConnectionId;");
         out.println("            this.sessionId = sessionId.Value;");
         out.println("            this.value = consumerId;");

[activemq-nms-openwire-generator] 28/32: Add a transient Exception field in MessageDispatch to store the Rollback cause.

Posted by df...@apache.org.
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 0e8f216d5a8b3475c29e6347d55cc674506302b5
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Apr 18 22:42:17 2013 +0000

    Add a transient Exception field in MessageDispatch to store the Rollback cause.
---
 .../tool/commands/MessageDispatchGenerator.java    | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
index 553e35a..29d0a31 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.nms.openwire.tool.commands;
 
+import java.io.PrintWriter;
+
 public class MessageDispatchGenerator extends CommandClassGenerator {
 
     public MessageDispatchGenerator() {
@@ -23,4 +25,29 @@ public class MessageDispatchGenerator extends CommandClassGenerator {
         this.setComparable(true);
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        super.generateUsingDirectives(out);
+
+        out.println("using System;");
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        out.println("        private Exception rollbackCause = null;");
+        out.println("");
+
+        super.generateProperties(out);
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+        out.println("        public Exception RollbackCause");
+        out.println("        {");
+        out.println("            get { return this.rollbackCause; }");
+        out.println("            set { this.rollbackCause = value; }");
+        out.println("        }");
+        out.println("");
+
+        super.generateAdditonalMembers( out );
+    }
+
 }

[activemq-nms-openwire-generator] 16/32: Clean up the generated to String methods for the commands to make the logging easier to read.

Posted by df...@apache.org.
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 33428d8bd942858fcd24016ac61f0be36e49c410
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Dec 16 23:34:54 2009 +0000

    Clean up the generated to String methods for the commands to make the logging easier to read.
---
 .../tool/commands/CommandClassGenerator.java       |  9 ++++++--
 .../tool/commands/ConnectionIdGenerator.java       |  6 +++++
 .../tool/commands/ConsumerIdGenerator.java         |  4 ++++
 .../tool/commands/LocalTransactionIdGenerator.java | 27 ++++++++++++++++++++++
 .../tool/commands/ProducerIdGenerator.java         |  4 ++++
 .../openwire/tool/commands/SessionIdGenerator.java |  4 ++++
 6 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 0ca7efc..a768d95 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -207,12 +207,17 @@ public class CommandClassGenerator extends CommandCodeGenerator {
 
     protected void generateToStringBody( PrintWriter out ) {
 
-        out.println("            return GetType().Name + \"[\" + ");
+        out.println("            return GetType().Name + \"[ \" + ");
+
+        if( getBaseClassName().equals( "BaseCommand" ) ) {
+            out.println("                \"commandId = \" + this.CommandId + \" \" + " );
+            out.println("                \"responseRequired = \" + this.ResponseRequired + \" \" + " );
+        }
 
         for( JProperty property : getProperties() ) {
             String name = property.getSimpleName();
 
-            out.println("                \"" + name + "=\" + " + name + " + " );
+            out.println("                \"" + name + " = \" + " + name + " + \" \" + " );
         }
 
         out.println("                \"]\";");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
index e8b1111..ef7d07e 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
@@ -18,6 +18,8 @@ package org.apache.activemq.nms.openwire.tool.commands;
 
 import java.io.PrintWriter;
 
+import org.codehaus.jam.JProperty;
+
 public class ConnectionIdGenerator extends CommandClassGenerator {
 
     protected void generateConstructors( PrintWriter out ) {
@@ -43,4 +45,8 @@ public class ConnectionIdGenerator extends CommandClassGenerator {
 
         super.generateConstructors(out);
     }
+
+    protected void generateToStringBody( PrintWriter out ) {
+        out.println("            return this.value;");
+    }
 }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
index dd0f666..036649d 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
@@ -37,6 +37,10 @@ public class ConsumerIdGenerator extends CommandClassGenerator {
         super.generateConstructors(out);
     }
 
+    protected void generateToStringBody( PrintWriter out ) {
+        out.println("            return this.connectionId + \":\" + this.sessionId + \":\" + this.value;");
+    }
+
     protected void generateProperties( PrintWriter out ) {
 
         out.println("        private SessionId parentId = null;");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/LocalTransactionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/LocalTransactionIdGenerator.java
new file mode 100644
index 0000000..515e5a7
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/LocalTransactionIdGenerator.java
@@ -0,0 +1,27 @@
+/**
+ * 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 LocalTransactionIdGenerator extends CommandClassGenerator {
+
+    protected void generateToStringBody( PrintWriter out ) {
+        out.println("            return this.connectionId + \":\" + this.value;");
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
index 0093505..8851735 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
@@ -56,6 +56,10 @@ public class ProducerIdGenerator extends CommandClassGenerator {
         super.generateProperties(out);
     }
 
+    protected void generateToStringBody( PrintWriter out ) {
+        out.println("            return this.connectionId + \":\" + this.sessionId + \":\" + this.value;");
+    }
+
     protected void generateAdditonalMembers( PrintWriter out ) {
         out.println("        public SessionId ParentId");
         out.println("        {");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
index 17b2b35..e957b61 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
@@ -56,6 +56,10 @@ public class SessionIdGenerator extends CommandClassGenerator {
         super.generateProperties(out);
     }
 
+    protected void generateToStringBody( PrintWriter out ) {
+        out.println("            return this.connectionId + \":\" + this.value;");
+    }
+
     protected void generateAdditonalMembers( PrintWriter out ) {
         out.println("        public ConnectionId ParentId");
         out.println("        {");

[activemq-nms-openwire-generator] 15/32: Update the .NET generator to generate an equals method for the MessageDispatch command.

Posted by df...@apache.org.
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 e5b5b3236e67ff7c7eb85bb6276ab33438eff83a
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Nov 30 19:08:06 2009 +0000

    Update the .NET generator to generate an equals method for the MessageDispatch command.
---
 .../openwire/tool/commands/CommandGenerator.java   |  2 +-
 .../tool/commands/MessageDispatchGenerator.java    | 26 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
index ef4eca1..be47189 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
@@ -84,7 +84,7 @@ public class CommandGenerator extends MultiSourceGenerator {
         generator.setClassName( getClassName() );
         generator.setBaseClassName( getBaseClass() );
         generator.setOpenWireOpCode( getOpenWireOpCode(getJclass()) );
-        generator.setComparable( className.endsWith("Id") );
+        generator.setComparable( className.endsWith("Id") || generator.isComparable() );
 
         PrintWriter out = null;
         try {
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
new file mode 100644
index 0000000..553e35a
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
@@ -0,0 +1,26 @@
+/**
+ * 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;
+
+public class MessageDispatchGenerator extends CommandClassGenerator {
+
+    public MessageDispatchGenerator() {
+        super();
+        this.setComparable(true);
+    }
+
+}

[activemq-nms-openwire-generator] 12/32: https://issues.apache.org/activemq/browse/AMQNET-193

Posted by df...@apache.org.
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 d7467477e55d09bcc710834500936947f70d65f7
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Oct 12 15:36:01 2009 +0000

    https://issues.apache.org/activemq/browse/AMQNET-193
    
    Update the MessageId and ProducerId command generation to add some convenience methods.
---
 .../openwire/tool/commands/MessageIdGenerator.java | 84 ++++++++++++++++++++++
 .../tool/commands/ProducerIdGenerator.java         | 12 ++++
 2 files changed, 96 insertions(+)

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
new file mode 100644
index 0000000..8decc9d
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageIdGenerator.java
@@ -0,0 +1,84 @@
+/**
+ * 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 MessageIdGenerator extends CommandClassGenerator {
+
+    protected void generateProperties( PrintWriter out ) {
+
+        super.generateProperties(out);
+
+        out.println("        private string key = null;");
+        out.println("");
+    }
+
+    protected void generateConstructors( PrintWriter out ) {
+
+        out.println("        public "+getClassName()+"() : base()");
+        out.println("        {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"(ProducerId producerId, long producerSequenceId) : base()");
+        out.println("        {");
+        out.println("            this.producerId = producerId;");
+        out.println("            this.producerSequenceId = producerSequenceId;");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"(string value) : base()");
+        out.println("        {");
+        out.println("            this.SetValue(value);");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+
+    protected void generateToStringBody( PrintWriter out ) {
+
+        out.println("            if(key == null) ");
+        out.println("            {");
+        out.println("                key = producerId.ToString() + \":\" + producerSequenceId;");
+        out.println("            }");
+        out.println("            ");
+        out.println("            return key;");
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+
+        out.println("        /// <summary>");
+        out.println("        /// Sets the value as a String");
+        out.println("        /// </summary>");
+        out.println("        public void SetValue(string messageKey)");
+        out.println("        {");
+        out.println("            this.key = messageKey;");
+        out.println("");
+        out.println("            // Parse off the sequenceId");
+        out.println("            int p = messageKey.LastIndexOf(\":\");");
+        out.println("            if(p >= 0)");
+        out.println("            {");
+        out.println("                producerSequenceId = Int64.Parse(messageKey.Substring(p + 1));");
+        out.println("                messageKey = messageKey.Substring(0, p);");
+        out.println("            }");
+        out.println("            producerId = new ProducerId(messageKey);");
+        out.println("        }");
+        out.println("");
+
+        super.generateAdditonalMembers( out );
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
index 46db0eb..0093505 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
@@ -33,6 +33,17 @@ public class ProducerIdGenerator extends CommandClassGenerator {
         out.println("            this.value = consumerId;");
         out.println("        }");
         out.println("");
+        out.println("        public "+getClassName()+"(string producerKey)");
+        out.println("        {");
+        out.println("            // Parse off the producerId");
+        out.println("            int p = producerKey.LastIndexOf(\":\");");
+        out.println("            if(p >= 0)");
+        out.println("            {");
+        out.println("                value = Int64.Parse(producerKey.Substring(p + 1));");
+        out.println("                producerKey = producerKey.Substring(0, p);");
+        out.println("            }");
+        out.println("        }");
+        out.println("");
 
         super.generateConstructors(out);
     }
@@ -58,6 +69,7 @@ public class ProducerIdGenerator extends CommandClassGenerator {
         out.println("        }");
         out.println("");
 
+
         super.generateAdditonalMembers( out );
     }
 

[activemq-nms-openwire-generator] 08/32: Cleans up the generated code a bit to match the existing coding conventions.

Posted by df...@apache.org.
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 cf517b88df0c8166e2466aec53732e53c3a525cb
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Jul 30 18:52:53 2009 +0000

    Cleans up the generated code a bit to match the existing coding conventions.
---
 .../marshalers/AmqCSharpMarshallersGenerator.java  | 37 +++++++---------------
 1 file changed, 11 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
index 0a680af..c27bec2 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
@@ -111,27 +111,6 @@ public class AmqCSharpMarshallersGenerator extends MultiSourceGenerator {
         return answer;
     }
 
-//    public boolean isMarshallAware(JClass j) {
-//
-//        String answer = jclass.getSimpleName();
-//
-//        if( answer.equals("ActiveMQTextMessage") ) {
-//            return true;
-//        } else if( answer.equals("ActiveMQBytesMessage") ) {
-//            return true;
-//        } else if( answer.equals("ActiveMQMapMessage") ) {
-//            return true;
-//        } else if( answer.equals("ActiveMQObjectMessage") ) {
-//            return true;
-//        } else if( answer.equals("ActiveMQStreamMessage") ) {
-//            return true;
-//        } else if( answer.equals("ActiveMBlobMessage") ) {
-//            return true;
-//        } else {
-//            return super.isMarshallAware(jclass);
-//        }
-//    }
-
     protected String getFilePostFix() {
         return ".cs";
     }
@@ -190,21 +169,23 @@ out.println(" */");
         out.println("    {");
 
         if (!isAbstractClass()) {
-            out.println("");
+            out.println("        /// <summery>");
+            out.println("        ///  Creates an instance of the Object that this marshaller handles.");
+            out.println("        /// </summery>");
             out.println("        public override DataStructure CreateObject() ");
             out.println("        {");
             out.println("            return new " + jclass.getSimpleName() + "();");
             out.println("        }");
             out.println("");
+            out.println("        /// <summery>");
+            out.println("        ///  Returns the type code for the Object that this Marshaller handles..");
+            out.println("        /// </summery>");
             out.println("        public override byte GetDataStructureType() ");
             out.println("        {");
             out.println("            return " + jclass.getSimpleName() + ".ID_" + jclass.getSimpleName().toUpperCase() + ";");
             out.println("        }");
         }
 
-        /*
-         * Generate the tight encoding marshallers
-         */
         out.println("");
         out.println("        // ");
         out.println("        // Un-marshal an object instance from the data input stream");
@@ -277,7 +258,6 @@ out.println(" */");
         }
 
         out.println("        }");
-
         out.println("");
         out.println("        // ");
         out.println("        // Un-marshal an object instance from the data input stream");
@@ -331,6 +311,7 @@ out.println(" */");
             out.println("");
             out.println("            info.AfterMarshall(wireFormat);");
         }
+
         out.println("        }");
         out.println("    }");
         out.println("}");
@@ -382,6 +363,10 @@ out.println(" */");
         out.println("    /// </summary>");
         out.println("    public class MarshallerFactory : IMarshallerFactory");
         out.println("    {");
+        out.println("        /// <summery>");
+        out.println("        ///  Adds the Marshallers for this version of the OpenWire protocol to the ");
+        out.println("        ///  Collection of Marshallers stored in the OpenWireFormat class.");
+        out.println("        /// </summery>");
         out.println("        public void configure(OpenWireFormat format) ");
         out.println("        {");
         out.println("            format.clearMarshallers();");

[activemq-nms-openwire-generator] 29/32: Generator updates to clean some code.

Posted by df...@apache.org.
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 eacd441b7bb7b01d4f8ef6f4e8dc87b936e38557
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Apr 29 18:31:25 2013 +0000

    Generator updates to clean some code.
---
 .../nms/openwire/tool/commands/CommandClassGenerator.java         | 4 ++--
 .../nms/openwire/tool/commands/ConnectionInfoGenerator.java       | 2 +-
 .../nms/openwire/tool/commands/ConsumerInfoGenerator.java         | 2 +-
 .../nms/openwire/tool/commands/DestinationInfoGenerator.java      | 4 ++--
 .../nms/openwire/tool/commands/ProducerInfoGenerator.java         | 2 +-
 .../activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java  | 8 ++++----
 .../activemq/nms/openwire/tool/commands/SessionInfoGenerator.java | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index bad5901..0ddfa1a 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -136,7 +136,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
             out.println("        ///  the proper processXXX method in the visitor." );
             out.println("        /// </summery>");
             out.println("        ///");
-            out.println("        public override Response visit(ICommandVisitor visitor)" );
+            out.println("        public override Response Visit(ICommandVisitor visitor)" );
             out.println("        {");
             generateVisitBody(out);
             out.println("        }");
@@ -198,7 +198,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
     }
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.process"+getClassName()+"(this);");
+        out.println("            return visitor.Process"+getClassName()+"(this);");
     }
 
     protected void generateToStringBody( PrintWriter out ) {
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java
index 77c647e..c60c213 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java
@@ -21,6 +21,6 @@ import java.io.PrintWriter;
 public class ConnectionInfoGenerator extends CommandClassGenerator {
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.processAddConnection( this );");
+        out.println("            return visitor.ProcessAddConnection( this );");
     }
 }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java
index 5eaf17b..00ad340 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java
@@ -21,6 +21,6 @@ import java.io.PrintWriter;
 public class ConsumerInfoGenerator extends CommandClassGenerator {
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.processAddConsumer( this );");
+        out.println("            return visitor.ProcessAddConsumer( this );");
     }
 }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java
index 7875203..11e6ad4 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java
@@ -24,11 +24,11 @@ public class DestinationInfoGenerator extends CommandClassGenerator {
 
         out.println("        if(IsAddOperation)");
         out.println("        {");
-        out.println("            return visitor.processAddDestination(this);");
+        out.println("            return visitor.ProcessAddDestination(this);");
         out.println("        }");
         out.println("        else if(IsRemoveOperation)");
         out.println("        {");
-        out.println("            return visitor.processRemoveDestination(this);");
+        out.println("            return visitor.ProcessRemoveDestination(this);");
         out.println("        }");
         out.println("        throw new IOException(\"Unknown operation type: \" + OperationType);");
 
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java
index 70d7f2c..768bd62 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java
@@ -21,6 +21,6 @@ import java.io.PrintWriter;
 public class ProducerInfoGenerator extends CommandClassGenerator {
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.processAddProducer( this );");
+        out.println("            return visitor.ProcessAddProducer( this );");
     }
 }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java
index 038dd71..1906163 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java
@@ -25,13 +25,13 @@ public class RemoveInfoGenerator extends CommandClassGenerator {
         out.println("            switch(objectId.GetDataStructureType())");
         out.println("            {");
         out.println("                case ConnectionId.ID_CONNECTIONID:");
-        out.println("                    return visitor.processRemoveConnection((ConnectionId) objectId);");
+        out.println("                    return visitor.ProcessRemoveConnection((ConnectionId) objectId);");
         out.println("                case SessionId.ID_SESSIONID:");
-        out.println("                    return visitor.processRemoveSession((SessionId) objectId);");
+        out.println("                    return visitor.ProcessRemoveSession((SessionId) objectId);");
         out.println("                case ConsumerId.ID_CONSUMERID:");
-        out.println("                    return visitor.processRemoveConsumer((ConsumerId) objectId);");
+        out.println("                    return visitor.ProcessRemoveConsumer((ConsumerId) objectId);");
         out.println("                case ProducerId.ID_PRODUCERID:");
-        out.println("                    return visitor.processRemoveProducer((ProducerId) objectId);");
+        out.println("                    return visitor.ProcessRemoveProducer((ProducerId) objectId);");
         out.println("                default:");
         out.println("                    throw new IOException(\"Unknown remove command type: \" + objectId.GetDataStructureType());");
         out.println("            }");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java
index 672949e..19138fb 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java
@@ -21,7 +21,7 @@ import java.io.PrintWriter;
 public class SessionInfoGenerator extends CommandClassGenerator {
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.processAddSession( this );");
+        out.println("            return visitor.ProcessAddSession( this );");
     }
 
     protected void generateConstructors( PrintWriter out ) {

[activemq-nms-openwire-generator] 20/32: https://issues.apache.org/activemq/browse/AMQNET-246 Fix the generated code to use correct interfaces.

Posted by df...@apache.org.
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 2ede2c6cfc48560145b17016107ee4263452a5fe
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Apr 5 15:47:48 2010 +0000

    https://issues.apache.org/activemq/browse/AMQNET-246
    Fix the generated code to use correct interfaces.
---
 pom.xml                                                          | 2 +-
 .../nms/openwire/tool/commands/CommandCodeGenerator.java         | 6 ++++++
 .../activemq/nms/openwire/tool/commands/CommandGenerator.java    | 9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 5669d39..ce3636c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
   </mailingLists>
 
   <properties>
-    <activemq-version>5.3.0</activemq-version>
+    <activemq-version>5.3.1</activemq-version>
     <projectName>Apache NMS.ActiveMQ</projectName>
     <annogen-version>0.1.0</annogen-version>
     <ant-version>1.6.2</ant-version>
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
index 7faaf0e..106c11f 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
@@ -145,6 +145,12 @@ public abstract class CommandCodeGenerator {
         else if( name.equals("ByteSequence") ) {
             return "byte[]";
         }
+        else if( name.equals("Comparable") ) {
+            return null;
+        }
+        else if( name.equals("MarshallAware") ) {
+            return null;
+        }
         else if( name.equals("boolean") ) {
             return "bool";
         }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
index be47189..a58015d 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
@@ -86,6 +86,15 @@ public class CommandGenerator extends MultiSourceGenerator {
         generator.setOpenWireOpCode( getOpenWireOpCode(getJclass()) );
         generator.setComparable( className.endsWith("Id") || generator.isComparable() );
 
+        for (int i = 0; i < getJclass().getInterfaces().length; i++) {
+            JClass intf = getJclass().getInterfaces()[i];
+
+            String name = generator.toCSharpType( intf );
+            if( name != null && !name.endsWith("DataStructure") && !name.equals("Command") ) {
+                generator.addAdditionalBase( name );
+            }
+        }
+
         PrintWriter out = null;
         try {
             out = new PrintWriter(new FileWriter(headerFile));

[activemq-nms-openwire-generator] 21/32: Update NMS Openwire Generator pom to use 5.4-SNAPSHOT.

Posted by df...@apache.org.
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 a6e066251505516a4fa69f3227f57e30a3532264
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Jul 7 14:49:41 2010 +0000

    Update NMS Openwire Generator pom to use 5.4-SNAPSHOT.
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index ce3636c..8630e4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
   </mailingLists>
 
   <properties>
-    <activemq-version>5.3.1</activemq-version>
+    <activemq-version>5.4-SNAPSHOT</activemq-version>
     <projectName>Apache NMS.ActiveMQ</projectName>
     <annogen-version>0.1.0</annogen-version>
     <ant-version>1.6.2</ant-version>
@@ -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="5" source="${activemq-core-dir}" target="${nms-activemq-dir}" />
+            <generate maxVersion="6" source="${activemq-core-dir}" target="${nms-activemq-dir}" />
           </tasks>
         </configuration>
       </plugin>

[activemq-nms-openwire-generator] 05/32: Commands Generator, produces CSharp Openwire Command classes with mostly all the same functionality as the older hand hacked ones, plus all the correct Openwire Protocol values for v1-v5

Posted by df...@apache.org.
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 3b257ca54bba89e1d4bdda8bbb66ca80e185b09c
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Jul 29 19:11:11 2009 +0000

    Commands Generator, produces CSharp Openwire Command classes with mostly all the same functionality as the older hand hacked ones, plus all the correct Openwire Protocol values for v1-v5
---
 .../nms/openwire/tool/AmqCSharpGeneratorTask.java  |   2 +-
 .../tool/commands/CommandClassGenerator.java       | 116 +++++++++++++++------
 .../tool/commands/CommandCodeGenerator.java        |  61 +++++------
 .../commands/CommandCodeGeneratorsFactory.java     |  66 +++---------
 .../openwire/tool/commands/CommandGenerator.java   |   9 +-
 .../tool/commands/ConnectionIdGenerator.java       |  46 ++++++++
 .../tool/commands/ConnectionInfoGenerator.java     |  26 +++++
 .../tool/commands/ConsumerIdGenerator.java         |  62 +++++++++++
 .../tool/commands/ConsumerInfoGenerator.java       |  26 +++++
 .../tool/commands/DestinationInfoGenerator.java    |  66 ++++++++++++
 .../openwire/tool/commands/MessageGenerator.java   |  54 ++++++++++
 .../tool/commands/ProducerIdGenerator.java         |  62 +++++++++++
 .../tool/commands/ProducerInfoGenerator.java       |  26 +++++
 .../tool/commands/RemoveInfoGenerator.java         |  39 +++++++
 .../openwire/tool/commands/SessionIdGenerator.java |  75 +++++++++++++
 .../tool/commands/SessionInfoGenerator.java        |  42 ++++++++
 .../tool/commands/TransactionInfoGenerator.java    |  63 +++++++++++
 17 files changed, 725 insertions(+), 116 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
index cf04a10..d3b84f5 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
@@ -29,7 +29,7 @@ import org.codehaus.jam.JamServiceParams;
 
 public class AmqCSharpGeneratorTask extends Task {
 
-    int maxVersion = 3;
+    int maxVersion = 5;
     File source = new File(".");
     File target = new File(".");
 
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index f86b677..40386eb 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -38,7 +38,6 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         out.println("");
         out.println("namespace Apache.NMS.ActiveMQ.Commands");
         out.println("{");
-        out.println("");
         out.println("    /*");
         out.println("     *");
         out.println("     *  Command code for OpenWire format for "+getClassName() );
@@ -57,6 +56,10 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         generateProperties( out );
 
         out.println("");
+
+        generateConstructors(out);
+
+        out.println("");
         out.println("        ///");
         out.println("        /// <summery>");
         out.println("        ///  Get the unique identifier that this object and its own");
@@ -68,16 +71,20 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         out.println("            return ID_" + getClassName().toUpperCase() + ";");
         out.println("        }");
         out.println("");
-//        out.println("        ///");
-//        out.println("        /// <summery>");
-//        out.println("        ///  Clone this object and return a new instance that the caller now owns.");
-//        out.println("        /// </summery>");
-//        out.println("        ///");
-//        out.println("        public override Object Clone()");
-//        out.println("        {");
-//        generateCloneBody( out );
-//        out.println("        }");
-//        out.println("");
+
+        if( isCloneable() ) {
+            out.println("        ///");
+            out.println("        /// <summery>");
+            out.println("        ///  Clone this object and return a new instance that the caller now owns.");
+            out.println("        /// </summery>");
+            out.println("        ///");
+            out.println("        public override Object Clone()");
+            out.println("        {");
+            generateCloneBody( out );
+            out.println("        }");
+            out.println("");
+        }
+
         out.println("        ///");
         out.println("        /// <summery>");
         out.println("        ///  Returns a string containing the information for this DataStructure");
@@ -93,7 +100,30 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         generateAdditonalMembers( out );
         generatePropertyAccessors( out );
 
-        if( isGenIsClass() ) {
+        if( isComparable() ) {
+
+            out.println("        public override int GetHashCode()");
+            out.println("        {");
+            generateHashCodeBody(out);
+            out.println("        }");
+            out.println("");
+            out.println("        public override bool Equals(object that)");
+            out.println("        {");
+            out.println("            if(that is "+getClassName()+")");
+            out.println("            {");
+            out.println("                return Equals(("+getClassName()+") that);");
+            out.println("            }");
+            out.println("            return false;");
+            out.println("        }");
+            out.println("");
+            out.println("        public virtual bool Equals("+getClassName()+" that)");
+            out.println("        {");
+            generateEqualsBody(out);
+            out.println("        }");
+
+        }
+
+        if( getBaseClassName().equals( "BaseCommand" ) ) {
             out.println("        ///");
             out.println("        /// <summery>");
             out.println("        ///  Return an answer of true to the is"+getClassName()+"() query.");
@@ -117,7 +147,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
             out.println("        ///  the proper processXXX method in the visitor." );
             out.println("        /// </summery>");
             out.println("        ///");
-            out.println("        public override Response visit( ICommandVisitor visitor )" );
+            out.println("        public override Response visit(ICommandVisitor visitor)" );
             out.println("        {");
             generateVisitBody(out);
             out.println("        }");
@@ -135,14 +165,26 @@ public class CommandClassGenerator extends CommandCodeGenerator {
 
         out.print( getBaseClassName() );
 
+        for( String name : getAdditionalBases() ) {
+            out.print( ", "+name );
+        }
+
         if( isMarshalAware() ) {
             out.print( ", MarshallAware" );
         }
 
+        if( isCloneable() ) {
+            out.print( ", ICloneable" );
+        }
+
         out.println();
         out.println("    {");
     }
 
+    protected void generateConstructors( PrintWriter out ) {
+        // The default constructor is fine for basic Commands.
+    }
+
     protected void generateProperties( PrintWriter out ) {
 
         for( JProperty property : getProperties() ) {
@@ -178,24 +220,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         out.println("            // this method is an override.");
         out.println("            " + getClassName() + " o = (" + getClassName() + ") base.Clone();");
         out.println("");
-
-        for( JProperty property : getProperties() ) {
-
-            String type = toCSharpType(property.getType());
-            String name = decapitalize(property.getSimpleName());
-
-            if( property.getType().isArrayType() ) {
-
-            } else if( !property.getType().isPrimitiveType() ) {
-
-                out.println("            if(o." + name + " != null)");
-                out.println("            {");
-                out.println("                o." + name + " = (" + type + ") o." + name + ".Clone();");
-                out.println("            }");
-                out.println("");
-            }
-
-        }
+        out.println("            return o;");
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {
@@ -218,4 +243,33 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         }
     }
 
+    protected void generateHashCodeBody( PrintWriter out ) {
+        out.println("            int answer = 0;");
+        out.println("");
+
+        for( JProperty property : getProperties() ) {
+            String accessorName = property.getSimpleName();
+
+            out.println("            answer = (answer * 37) + HashCode("+accessorName+");");
+        }
+
+        out.println("");
+        out.println("            return answer;");
+    }
+
+    protected void generateEqualsBody( PrintWriter out ) {
+
+        for( JProperty property : getProperties() ) {
+            String accessorName = property.getSimpleName();
+
+            out.println("            if(!Equals(this."+accessorName+", that."+accessorName+"))");
+            out.println("            {");
+            out.println("                return false;");
+            out.println("            }");
+        }
+
+        out.println("");
+        out.println("            return true;");
+    }
+
 }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
index cbacec2..7faaf0e 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
@@ -18,6 +18,8 @@ package org.apache.activemq.nms.openwire.tool.commands;
 
 import java.io.PrintWriter;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 
 import org.codehaus.jam.JClass;
 import org.codehaus.jam.JProperty;
@@ -26,11 +28,13 @@ public abstract class CommandCodeGenerator {
 
     private JClass jClass;
     private List<JProperty> properties;
+    private Set<String> additionalBases = new TreeSet<String>();
     private boolean marshalAware = false;
     private String className;
     private String baseClassName;
     private String openWireOpCode;
-    private boolean genIsClass = false;
+    private boolean cloneable;
+    private boolean comparable;
 
     public abstract void generate( PrintWriter out );
 
@@ -54,14 +58,6 @@ public abstract class CommandCodeGenerator {
         out.println("");
     }
 
-    public boolean isGenIsClass() {
-        return genIsClass;
-    }
-
-    public void setGenIsClass(boolean genIsClass) {
-        this.genIsClass = genIsClass;
-    }
-
     public JClass getJClass() {
         return jClass;
     }
@@ -78,6 +74,14 @@ public abstract class CommandCodeGenerator {
         this.properties = properties;
     }
 
+    public boolean isComparable() {
+        return comparable;
+    }
+
+    public void setComparable(boolean comparable) {
+        this.comparable = comparable;
+    }
+
     public boolean isMarshalAware() {
         return marshalAware;
     }
@@ -86,6 +90,14 @@ public abstract class CommandCodeGenerator {
         this.marshalAware = marshalAware;
     }
 
+    public boolean isCloneable() {
+        return cloneable;
+    }
+
+    public void setCloneable(boolean cloneable) {
+        this.cloneable = cloneable;
+    }
+
     public String getClassName() {
         return className;
     }
@@ -110,26 +122,17 @@ public abstract class CommandCodeGenerator {
         this.openWireOpCode = openWireOpCode;
     }
 
-//    protected String toFileName( JClass type ) {
-//        String name = type.getSimpleName();
-//
-//        if( name.equals( "String" ) ) {
-//            return null;
-//        } else if( type.isArrayType() ) {
-//            JClass arrayClass = type.getArrayComponentType();
-//            return toHeaderFileName( arrayClass );
-//        } else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
-//            return "BrokerError";
-//        } else if( name.equals("BaseDataStructure" ) ){
-//            return "DataStructure";
-//        } else if( name.equals("ByteSequence") ) {
-//            return "std::vector<unsigned char>";
-//        } else if( !type.isPrimitiveType() ) {
-//            return name;
-//        } else {
-//            return null;
-//        }
-//    }
+    public void addAdditionalBase( String name ) {
+        this.additionalBases.add(name);
+    }
+
+    public Set<String> getAdditionalBases() {
+        return additionalBases;
+    }
+
+    public void setAdditionalBases(Set<String> additionalBases) {
+        this.additionalBases = additionalBases;
+    }
 
     protected String toCSharpType(JClass type) {
         String name = type.getSimpleName();
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
index 95ae4ce..fd3e45c 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
@@ -16,9 +16,6 @@
  */
 package org.apache.activemq.nms.openwire.tool.commands;
 
-import java.util.HashSet;
-import java.util.Set;
-
 /**
  * Provides methods to get a Source file and Header file Code generator given a Class
  * name.
@@ -27,35 +24,6 @@ import java.util.Set;
  */
 public class CommandCodeGeneratorsFactory {
 
-    private Set<String> commandsWithShortcuts;
-
-    /*
-     * Here we store all Commands that need to have a isXXX method generated
-     * such as isMessage.  We then check in the <code>checkNeedsShortcut</code>
-     * method and if the Command being generated is in this list we create a
-     * method call to override the virtual method in the base Command interface.
-     */
-    {
-        commandsWithShortcuts = new HashSet<String>();
-        commandsWithShortcuts.add( "Response" );
-        commandsWithShortcuts.add( "RemoveInfo" );
-        commandsWithShortcuts.add( "MessageDispatch" );
-        commandsWithShortcuts.add( "BrokerInfo" );
-        commandsWithShortcuts.add( "KeepAliveInfo" );
-        commandsWithShortcuts.add( "WireFormatInfo" );
-        commandsWithShortcuts.add( "Message" );
-        commandsWithShortcuts.add( "MessageAck" );
-        commandsWithShortcuts.add( "ProducerAck" );
-        commandsWithShortcuts.add( "ProducerInfo" );
-        commandsWithShortcuts.add( "MessageDispatchNotification" );
-        commandsWithShortcuts.add( "ShutdownInfo" );
-        commandsWithShortcuts.add( "TransactionInfo" );
-        commandsWithShortcuts.add( "ConnectionInfo" );
-        commandsWithShortcuts.add( "ConsumerInfo" );
-        commandsWithShortcuts.add( "RemoveSubscriptionInfo" );
-
-    }
-
     /**
      * Given a class name return an instance of a CSharp Class File Generator
      * that can generate the file for the Class.
@@ -66,25 +34,23 @@ public class CommandCodeGeneratorsFactory {
      */
     public CommandCodeGenerator getCodeGenerator( String className ) {
 
-        CommandCodeGenerator generator = null;
-//        if( className.equals("Message") ) {
-//            generator = new MessageHeaderGenerator();
-//        } else if( className.equals("ConnectionId") ) {
-//            generator = new ConnectionIdHeaderGenerator();
-//        } else if( className.equals("ConsumerId") ) {
-//            generator = new ConsumerIdHeaderGenerator();
-//        } else if( className.equals("ProducerId") ) {
-//            generator = new ProducerIdHeaderGenerator();
-//        } else if( className.equals("SessionId") ) {
-//            generator = new SessionIdHeaderGenerator();
-//        } else if( className.equals("SessionInfo") ) {
-//            generator = new SessionInfoHeaderGenerator();
-//        } else {
-            generator = new CommandClassGenerator();
-//        }
+        Class<?> generatorClass = null;
+
+        try {
+            generatorClass = Class.forName( "org.apache.activemq.nms.openwire.tool.commands." + className + "Generator" );
+        } catch (ClassNotFoundException e) {
+            return new CommandClassGenerator();
+        }
 
-        if( this.commandsWithShortcuts.contains( className ) ) {
-            generator.setGenIsClass( true );
+        CommandCodeGenerator generator;
+        try {
+            generator = (CommandCodeGenerator) generatorClass.newInstance();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+            return null;
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+            return null;
         }
 
         return generator;
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
index efe5a67..ef4eca1 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
@@ -56,7 +56,7 @@ public class CommandGenerator extends MultiSourceGenerator {
 
         try {
             // Using the current JClass state in the MultiSourceGenerator we can
-            // now generate the Header and Source for the CSharp commands.
+            // now generate the Source for the CSharp commands.
             generateClassFile();
         } catch (Exception e) {
             e.printStackTrace();
@@ -64,7 +64,6 @@ public class CommandGenerator extends MultiSourceGenerator {
     }
 
     public Object run() {
-        filePostFix = ".cs";
         if (destDir == null) {
             destDir = new File(
                 targetDir+"/Commands");
@@ -75,7 +74,7 @@ public class CommandGenerator extends MultiSourceGenerator {
 
     protected void generateClassFile() throws Exception {
 
-        File headerFile = new File(destDir, className + filePostFix);
+        File headerFile = new File(destDir, className + ".cs");
 
         CommandCodeGenerator generator = generatorsFactory.getCodeGenerator( className );
 
@@ -85,6 +84,7 @@ public class CommandGenerator extends MultiSourceGenerator {
         generator.setClassName( getClassName() );
         generator.setBaseClassName( getBaseClass() );
         generator.setOpenWireOpCode( getOpenWireOpCode(getJclass()) );
+        generator.setComparable( className.endsWith("Id") );
 
         PrintWriter out = null;
         try {
@@ -99,8 +99,7 @@ public class CommandGenerator extends MultiSourceGenerator {
         }
 
         // Use the FixCRLF Ant Task to make sure the file has consistent
-        // newlines
-        // so that SVN does not complain on checkin.
+        // newlines so that SVN does not complain on checkin.
         Project project = new Project();
         project.init();
         FixCRLF fixCRLF = new FixCRLF();
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
new file mode 100644
index 0000000..e8b1111
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
@@ -0,0 +1,46 @@
+/**
+ * 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 ConnectionIdGenerator extends CommandClassGenerator {
+
+    protected void generateConstructors( PrintWriter out ) {
+        out.println("        public "+getClassName()+"()");
+        out.println("        {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( SessionId sessionId )");
+        out.println("        {");
+        out.println("            this.value = sessionId.ConnectionId;");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( ProducerId producerId )");
+        out.println("        {");
+        out.println("            this.value = producerId.ConnectionId;");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( ConsumerId consumerId )");
+        out.println("        {");
+        out.println("            this.value = consumerId.ConnectionId;");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java
new file mode 100644
index 0000000..77c647e
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionInfoGenerator.java
@@ -0,0 +1,26 @@
+/**
+ * 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 ConnectionInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+        out.println("            return visitor.processAddConnection( this );");
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
new file mode 100644
index 0000000..396a85c
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
@@ -0,0 +1,62 @@
+/**
+ * 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 ConsumerIdGenerator extends CommandClassGenerator {
+
+    protected void generateConstructors( PrintWriter out ) {
+
+        out.println("        public "+getClassName()+"() {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( SessionId sessionId, long consumerId ) {");
+        out.println("            this.connectionId = sessionId.ConnectionId;");
+        out.println("            this.sessionId = sessionId.Value;");
+        out.println("            this.value = consumerId;");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        out.println("        private SessionId parentId = null;");
+        out.println("");
+
+        super.generateProperties(out);
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+        out.println("        public SessionId ParentId");
+        out.println("        {");
+        out.println("            get");
+        out.println("            {");
+        out.println("                 if( this.parentId == null ) {");
+        out.println("                     this.parentId = new SessionId( this );");
+        out.println("                 }");
+        out.println("                 return this.parentId;");
+        out.println("            }");
+        out.println("        }");
+        out.println("");
+
+        super.generateAdditonalMembers( out );
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java
new file mode 100644
index 0000000..5eaf17b
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerInfoGenerator.java
@@ -0,0 +1,26 @@
+/**
+ * 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 ConsumerInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+        out.println("            return visitor.processAddConsumer( this );");
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java
new file mode 100644
index 0000000..7875203
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/DestinationInfoGenerator.java
@@ -0,0 +1,66 @@
+/**
+ * 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 DestinationInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+
+        out.println("        if(IsAddOperation)");
+        out.println("        {");
+        out.println("            return visitor.processAddDestination(this);");
+        out.println("        }");
+        out.println("        else if(IsRemoveOperation)");
+        out.println("        {");
+        out.println("            return visitor.processRemoveDestination(this);");
+        out.println("        }");
+        out.println("        throw new IOException(\"Unknown operation type: \" + OperationType);");
+
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        out.println("        public const byte ADD_OPERATION_TYPE = 0;");
+        out.println("        public const byte REMOVE_OPERATION_TYPE = 1;");
+
+        super.generateProperties(out);
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+
+        out.println("        public bool IsAddOperation");
+        out.println("        {");
+        out.println("            get");
+        out.println("            {");
+        out.println("                return OperationType == ADD_OPERATION_TYPE;");
+        out.println("            }");
+        out.println("        }");
+        out.println("");
+        out.println("        public bool IsRemoveOperation");
+        out.println("        {");
+        out.println("            get");
+        out.println("            {");
+        out.println("                return OperationType == REMOVE_OPERATION_TYPE;");
+        out.println("            }");
+        out.println("        }");
+
+        super.generateAdditonalMembers(out);
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
new file mode 100644
index 0000000..b92fa62
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -0,0 +1,54 @@
+/**
+ * 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 MessageGenerator extends CommandClassGenerator {
+
+    public MessageGenerator() {
+        super.setMarshalAware(true);
+        super.setCloneable(true);
+        super.addAdditionalBase("MessageReference");
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        super.generateProperties(out);
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+
+        super.generateAdditonalMembers( out );
+    }
+
+    protected void generateCloneBody( PrintWriter out ) {
+
+        out.println("            // Since we are a derived class use the base's Clone()");
+        out.println("            // to perform the shallow copy. Since it is shallow it");
+        out.println("            // will include our derived class. Since we are derived,");
+        out.println("            // this method is an override.");
+        out.println("            " + getClassName() + " o = (" + getClassName() + ") base.Clone();");
+        out.println("");
+        out.println("            if( this.messageId != null )");
+        out.println("            {");
+        out.println("                o.MessageId = (MessageId) this.messageId.Clone();");
+        out.println("            }");
+        out.println("");
+        out.println("            return o;");
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
new file mode 100644
index 0000000..c42817a
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
@@ -0,0 +1,62 @@
+/**
+ * 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 ProducerIdGenerator extends CommandClassGenerator {
+
+    protected void generateConstructors( PrintWriter out ) {
+
+        out.println("        public "+getClassName()+"() {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( SessionId sessionId, long consumerId ) {");
+        out.println("            this.connectionId = sessionId.ConnectionId;");
+        out.println("            this.sessionId = sessionId.Value;");
+        out.println("            this.value = consumerId;");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        out.println("        private SessionId parentId;");
+        out.println("");
+
+        super.generateProperties(out);
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+        out.println("        public SessionId ParentId");
+        out.println("        {");
+        out.println("            get");
+        out.println("            {");
+        out.println("                 if( this.parentId == null ) {");
+        out.println("                     this.parentId = new SessionId( this );");
+        out.println("                 }");
+        out.println("                 return this.parentId;");
+        out.println("            }");
+        out.println("        }");
+        out.println("");
+
+        super.generateAdditonalMembers( out );
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java
new file mode 100644
index 0000000..70d7f2c
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerInfoGenerator.java
@@ -0,0 +1,26 @@
+/**
+ * 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 ProducerInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+        out.println("            return visitor.processAddProducer( this );");
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java
new file mode 100644
index 0000000..038dd71
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/RemoveInfoGenerator.java
@@ -0,0 +1,39 @@
+/**
+ * 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 RemoveInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+
+        out.println("            switch(objectId.GetDataStructureType())");
+        out.println("            {");
+        out.println("                case ConnectionId.ID_CONNECTIONID:");
+        out.println("                    return visitor.processRemoveConnection((ConnectionId) objectId);");
+        out.println("                case SessionId.ID_SESSIONID:");
+        out.println("                    return visitor.processRemoveSession((SessionId) objectId);");
+        out.println("                case ConsumerId.ID_CONSUMERID:");
+        out.println("                    return visitor.processRemoveConsumer((ConsumerId) objectId);");
+        out.println("                case ProducerId.ID_PRODUCERID:");
+        out.println("                    return visitor.processRemoveProducer((ProducerId) objectId);");
+        out.println("                default:");
+        out.println("                    throw new IOException(\"Unknown remove command type: \" + objectId.GetDataStructureType());");
+        out.println("            }");
+    }
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
new file mode 100644
index 0000000..2e86d45
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
@@ -0,0 +1,75 @@
+/**
+ * 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 SessionIdGenerator extends CommandClassGenerator {
+
+    protected void generateConstructors( PrintWriter out ) {
+
+        out.println("        public "+getClassName()+"()");
+        out.println("        {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( ConnectionId connectionId, long sessionId )");
+        out.println("        {");
+        out.println("            this.ConnectionId = connectionId.Value;");
+        out.println("            this.value = sessionId;");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( ProducerId producerId )");
+        out.println("        {");
+        out.println("            this.ConnectionId = producerId.ConnectionId;");
+        out.println("            this.value = producerId.SessionId;");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"( ConsumerId consumerId )");
+        out.println("        {");
+        out.println("            this.ConnectionId = consumerId.ConnectionId;");
+        out.println("            this.value = consumerId.SessionId;");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        out.println("        private ConnectionId parentId;");
+        out.println("");
+
+        super.generateProperties(out);
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+        out.println("        public ConnectionId getParentId");
+        out.println("        {");
+        out.println("            get");
+        out.println("            {");
+        out.println("                 if( this.parentId == null ) {");
+        out.println("                     this.parentId = new ConnectionId( this );");
+        out.println("                 }");
+        out.println("                 return this.parentId;");
+        out.println("            }");
+        out.println("        }");
+        out.println("");
+
+        super.generateAdditonalMembers( out );
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java
new file mode 100644
index 0000000..672949e
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionInfoGenerator.java
@@ -0,0 +1,42 @@
+/**
+ * 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 SessionInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+        out.println("            return visitor.processAddSession( this );");
+    }
+
+    protected void generateConstructors( PrintWriter out ) {
+
+        out.println("        public "+getClassName()+"()");
+        out.println("        {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"(ConnectionInfo connectionInfo, long sessionId)");
+        out.println("        {");
+        out.println("            this.sessionId = new SessionId(connectionInfo.ConnectionId, sessionId);");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+
+}
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
new file mode 100644
index 0000000..025a68c
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/TransactionInfoGenerator.java
@@ -0,0 +1,63 @@
+/**
+ * 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 TransactionInfoGenerator extends CommandClassGenerator {
+
+    protected void generateVisitBody( PrintWriter out ) {
+
+        out.println("            switch(type)");
+        out.println("            {");
+        out.println("                case TransactionInfo.BEGIN:");
+        out.println("                    return visitor.processBeginTransaction(this);");
+        out.println("                case TransactionInfo.END:");
+        out.println("                    return visitor.processEndTransaction(this);");
+        out.println("                case TransactionInfo.PREPARE:");
+        out.println("                    return visitor.processPrepareTransaction(this);");
+        out.println("                case TransactionInfo.COMMIT_ONE_PHASE:");
+        out.println("                    return visitor.processCommitTransactionOnePhase(this);");
+        out.println("                case TransactionInfo.COMMIT_TWO_PHASE:");
+        out.println("                    return visitor.processCommitTransactionTwoPhase(this);");
+        out.println("                case TransactionInfo.ROLLBACK:");
+        out.println("                    return visitor.processRollbackTransaction(this);");
+        out.println("                case TransactionInfo.RECOVER:");
+        out.println("                    return visitor.processRecoverTransactions(this);");
+        out.println("                case TransactionInfo.FORGET:");
+        out.println("                    return visitor.processForgetTransaction(this);");
+        out.println("                default:");
+        out.println("                    throw new IOException(\"Transaction info type unknown: \" + type);");
+        out.println("            }");
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
+        out.println("        public const byte BEGIN = 0;");
+        out.println("        public const byte PREPARE = 1;");
+        out.println("        public const byte COMMIT_ONE_PHASE = 2;");
+        out.println("        public const byte COMMIT_TWO_PHASE = 3;");
+        out.println("        public const byte ROLLBACK = 4;");
+        out.println("        public const byte RECOVER = 5;");
+        out.println("        public const byte FORGET = 6;");
+        out.println("        public const byte END = 7;");
+        out.println("");
+
+        super.generateProperties(out);
+    }
+
+}

[activemq-nms-openwire-generator] 25/32: Updates the generator for some things needed in: https://issues.apache.org/jira/browse/AMQNET-290

Posted by df...@apache.org.
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 2070215d21384fbd4e3092eb6d5cb6969f60501f
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Jan 20 15:58:35 2011 +0000

    Updates the generator for some things needed in:
    https://issues.apache.org/jira/browse/AMQNET-290
---
 .../tool/commands/CommandClassGenerator.java        | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 20c4782..ac04e97 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -221,7 +221,11 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         for( JProperty property : getProperties() ) {
             String name = property.getSimpleName();
 
-            out.print("                \"" + name + " = \" + " + name + " + ");
+            if( property.getType().isArrayType() && toCSharpType(property.getType()).startsWith("byte")) {
+                out.print("                \"" + name + " = \" + System.Text.ASCIIEncoding.ASCII.GetString(" + name + ") + ");
+            } else {
+                out.print("                \"" + name + " = \" + " + name + " + ");
+            }
 
             if( ++count != size ) {
                 out.println("\", \" + ");
@@ -287,10 +291,17 @@ public class CommandClassGenerator extends CommandCodeGenerator {
             for( JProperty property : getProperties() ) {
                 String accessorName = property.getSimpleName();
 
-                out.println("            if(!Equals(this."+accessorName+", that."+accessorName+"))");
-                out.println("            {");
-                out.println("                return false;");
-                out.println("            }");
+                if( !property.getType().isArrayType() ) {
+                    out.println("            if(!Equals(this."+accessorName+", that."+accessorName+"))");
+                    out.println("            {");
+                    out.println("                return false;");
+                    out.println("            }");
+                } else {
+                    out.println("            if(!ArrayEquals(this."+accessorName+", that."+accessorName+"))");
+                    out.println("            {");
+                    out.println("                return false;");
+                    out.println("            }");
+                }
             }
 
             out.println("");

[activemq-nms-openwire-generator] 32/32: AMQNET-562 Update NOTICE file

Posted by df...@apache.org.
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 d16ff371fecade87f97942cdf0174ab790bc999c
Author: Timothy Bish <ta...@gmail.com>
AuthorDate: Mon Mar 13 09:41:36 2017 -0400

    AMQNET-562 Update NOTICE file
    
    Update date range to current year.
---
 LICENSE.txt | 764 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 NOTICE.txt  |  12 +
 2 files changed, 776 insertions(+)

diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100755
index 0000000..e52ce5d
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,764 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+APACHE ACTIVEMQ DEPENDENCIES:
+
+The Apache ActiveMQ message broker includes a number of dependencies, many 
+of them optional, with separate copyright notices and license terms. Your 
+use of the source code for the these subcomponents is subject to the terms 
+and conditions of the following licenses. 
+
+For the backport-util-concurrent library:
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<html><head><title>Creative Commons Public Domain</title>
+
+<body>
+
+<p align="center"><em>Copyright-Only Dedication (based on United States law) or Public Domain Certification</em></p>
+
+        <p>The
+person or persons who have associated work with this document (the
+"Dedicator" or "Certifier") hereby either (a) certifies that, to the
+best of his knowledge, the work of authorship identified is in the
+public domain of the country from which the work is published, or (b)
+hereby dedicates whatever copyright the dedicators holds in the work of
+authorship identified below (the "Work") to the public domain. A
+certifier, morever, dedicates any copyright interest he may have in the
+associated work, and for these purposes, is described as a "dedicator"
+below.</p>
+
+        <p>A certifier has taken reasonable steps to verify
+the copyright status of this work. Certifier recognizes that his good
+faith efforts may not shield him from liability if in fact the work
+certified is not in the public domain.</p>
+
+        <p>Dedicator makes
+this dedication for the benefit of the public at large and to the
+detriment of the Dedicator's heirs and successors. Dedicator intends
+this dedication to be an overt act of relinquishment in perpetuity of
+all present and future rights under copyright law, whether vested or
+contingent, in the Work. Dedicator understands that such relinquishment
+of all rights includes the relinquishment of all rights to enforce (by
+lawsuit or otherwise) those copyrights in the Work.</p>
+
+        <p>Dedicator
+recognizes that, once placed in the public domain, the Work may be
+freely reproduced, distributed, transmitted, used, modified, built
+upon, or otherwise exploited by anyone for any purpose, commercial or
+non-commercial, and in any way, including by methods that have not yet
+been invented or conceived.</p>
+    </div>
+</div>
+</body></html>
+
+For the mx4j, mx4j-remote, and mx4j-tools library:
+
+         The MX4J License, Version 1.0
+
+         Copyright (c) 2001-2004 by the MX4J contributors.  All rights reserved.
+
+         Redistribution and use in source and binary forms, with or without
+         modification, are permitted provided that the following conditions
+         are met:
+
+         1. Redistributions of source code must retain the above copyright
+            notice, this list of conditions and the following disclaimer.
+
+         2. Redistributions in binary form must reproduce the above copyright
+            notice, this list of conditions and the following disclaimer in
+            the documentation and/or other materials provided with the
+            distribution.
+
+         3. The end-user documentation included with the redistribution,
+            if any, must include the following acknowledgment:
+               "This product includes software developed by the
+                MX4J project (http://mx4j.sourceforge.net)."
+            Alternately, this acknowledgment may appear in the software itself,
+            if and wherever such third-party acknowledgments normally appear.
+
+         4. The name "MX4J" must not be used to endorse or promote
+            products derived from this software without prior written
+            permission.
+            For written permission, please contact
+            biorn_steedom [at] users [dot] sourceforge [dot] net
+
+         5. Products derived from this software may not be called "MX4J",
+            nor may "MX4J" appear in their name, without prior written
+            permission of Simone Bordet.
+
+         THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+         WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+         DISCLAIMED.  IN NO EVENT SHALL THE MX4J CONTRIBUTORS
+         BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+         LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+         USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+         ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+         OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+         SUCH DAMAGE.
+         ====================================================================
+
+         This software consists of voluntary contributions made by many
+         individuals on behalf of the MX4J project.  For more information on
+         MX4J, please see
+         <a href="http://mx4j.sourceforge.net" target="_top">the MX4J website</a>.
+
+For the jetty and jetty-util library:
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+For the xmlpull library:
+
+XMLPULL API IS FREE
+-------------------
+
+All of the XMLPULL API source code, compiled code, and documentation 
+contained in this distribution *except* for tests (see separate LICENSE_TESTS.txt)
+are in the Public Domain.
+
+XMLPULL API comes with NO WARRANTY or guarantee of fitness for any purpose.
+
+Initial authors:
+
+  Stefan Haustein
+  Aleksander Slominski
+
+2001-12-12
+
+For the spring library:
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+For the xstream library:
+
+(BSD Style License)
+
+Copyright (c) 2003-2004, Joe Walnes
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer. Redistributions in binary form must reproduce
+the above copyright notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+Neither the name of XStream nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 0000000..1c50c18
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,12 @@
+=========================================================================
+==  NOTICE file corresponding to the section 4 d of                    ==
+==  the Apache License, Version 2.0,                                   ==
+==  in this case for the Apache ActiveMQ distribution.                 ==
+=========================================================================
+
+Apache ActiveMQ
+Copyright 2005-2017 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

[activemq-nms-openwire-generator] 04/32: First workable version of Command Class generation. Needs more work now to implement specific Commands that require special methods and extensions.

Posted by df...@apache.org.
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 c31b80e30f6ef1ed68d9e38be7f4e38e714ce763
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Tue Jul 28 20:16:49 2009 +0000

    First workable version of Command Class generation.  Needs more work now to implement specific Commands that require special methods and extensions.
---
 pom.xml                                            |  12 +
 .../nms/openwire/tool/AmqCSharpGeneratorTask.java  |   2 +-
 .../tool/commands/CommandClassGenerator.java       | 304 ++++++++-------------
 .../tool/commands/CommandCodeGenerator.java        | 105 ++-----
 .../commands/CommandCodeGeneratorsFactory.java     |   5 -
 .../openwire/tool/commands/CommandGenerator.java   |   8 +-
 6 files changed, 160 insertions(+), 276 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6978061..c3ad024 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,6 +67,7 @@
     <ant-version>1.6.2</ant-version>
     <xstream-version>1.3.1</xstream-version>
     <activemq-core-dir>${ACTIVEMQ_SRC_HOME}/activemq-core/</activemq-core-dir>
+    <nms-activemq-dir>${NMS_ACTIVEMQ_HOME}</nms-activemq-dir>
   </properties>
 
   <dependencies>
@@ -131,6 +132,17 @@
           <target>1.5</target>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <configuration>
+          <tasks>
+            <echo>Running OpenWire Generator</echo>
+            <taskdef name="generate" classname="org.apache.activemq.nms.openwire.tool.AmqCSharpGeneratorTask" classpathref="maven.compile.classpath" />
+            <generate maxVersion="5" source="${activemq-core-dir}" target="${nms-activemq-dir}" />
+          </tasks>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
index 66c8c93..cf04a10 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
@@ -76,7 +76,7 @@ public class AmqCSharpGeneratorTask extends Task {
             {
                 CommandGenerator script = new CommandGenerator();
                 script.setJam(jam);
-                script.setTargetDir(target + "/src/main");
+                script.setTargetDir(target + "/src/main/csharp");
                 script.setOpenwireVersion(maxVersion);
                 script.run();
             }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 9098802..f86b677 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.nms.openwire.tool.commands;
 
 import java.io.PrintWriter;
-import java.util.Set;
 
 import org.codehaus.jam.JProperty;
 
@@ -28,27 +27,17 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         // Start with the license.
         generateLicence(out);
 
-        out.println("#ifndef _ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_");
-        out.println("#define _ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_");
-        out.println("");
-        out.println("// Turn off warning message for ignored exception specification");
-        out.println("#ifdef _MSC_VER");
-        out.println("#pragma warning( disable : 4290 )");
-        out.println("#endif");
-        out.println("");
+        out.println("using System;");
+        out.println("using System.Collections;");
 
-        populateIncludeFilesSet();
-        for( String include : getIncludeFiles() ) {
-            if( include != null ) {
-                out.println("#include "+include);
-            }
+        if( getBaseClassName().equals( "BaseCommand" ) ) {
+            out.println("");
+            out.println("using Apache.NMS.ActiveMQ.State;");
         }
 
         out.println("");
-        generateNamespaceWrapper( out );
-        generateForwardDeclarations( out );
-
-        out.println("    using decaf::lang::Pointer;");
+        out.println("namespace Apache.NMS.ActiveMQ.Commands");
+        out.println("{");
         out.println("");
         out.println("    /*");
         out.println("     *");
@@ -56,237 +45,176 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         out.println("     *");
         out.println("     *  NOTE!: This file is auto generated - do not modify!");
         out.println("     *         if you need to make a change, please see the Java Classes");
-        out.println("     *         in the activemq-cpp-openwire-generator module");
+        out.println("     *         in the nms-activemq-openwire-generator module");
         out.println("     *");
         out.println("     */");
 
         generateClassDefinition( out );
-        generateProperties( out );
 
-        if( !isAssignable() ) {
-            out.println("    protected:");
-            out.println("");
-            out.println("        "+getClassName()+"( const "+getClassName()+"& ) : " + getBaseClassName() + "() {};");
-            out.println("        "+getClassName()+"& operator= ( const "+getClassName()+"& ) { return *this; };");
-            out.println("");
-        }
-
-        out.println("    public:");
+        out.println("        public const byte ID_"+ getClassName().toUpperCase() + " = " + getOpenWireOpCode() + ";");
         out.println("");
-        out.println("        "+getClassName()+"();");
-        out.println("");
-
-        if( isAssignable() ) {
-            out.println("        "+getClassName()+"( const "+getClassName()+"& other );");
-            out.println("");
-        }
 
-        generateAdditionalConstructors( out );
+        generateProperties( out );
 
-        out.println("        virtual ~"+getClassName()+"();");
-        out.println("");
-        out.println("        /**");
-        out.println("         * Get the unique identifier that this object and its own");
-        out.println("         * Marshaler share.");
-        out.println("         * @returns new DataStructure type copy.");
-        out.println("         */");
-        out.println("        virtual unsigned char getDataStructureType() const;");
         out.println("");
-        out.println("        /**");
-        out.println("         * Clone this object and return a new instance that the");
-        out.println("         * caller now owns, this will be an exact copy of this one");
-        out.println("         * @returns new copy of this object.");
-        out.println("         */");
-        out.println("        virtual "+getClassName()+"* cloneDataStructure() const;");
-        out.println("");
-        out.println("        /**");
-        out.println("         * Copy the contents of the passed object into this object's");
-        out.println("         * members, overwriting any existing data.");
-        out.println("         * @param src - Source Object");
-        out.println("         */");
-        out.println("        virtual void copyDataStructure( const DataStructure* src );");
-        out.println("");
-        out.println("        /**");
-        out.println("         * Returns a string containing the information for this DataStructure");
-        out.println("         * such as its type and value of its elements.");
-        out.println("         * @return formatted string useful for debugging.");
-        out.println("         */");
-        out.println("        virtual std::string toString() const;");
-        out.println("");
-        out.println("        /**" );
-        out.println("         * Compares the DataStructure passed in to this one, and returns if" );
-        out.println("         * they are equivalent.  Equivalent here means that they are of the" );
-        out.println("         * same type, and that each element of the objects are the same." );
-        out.println("         * @returns true if DataStructure's are Equal." );
-        out.println("         */" );
-        out.println("        virtual bool equals( const DataStructure* value ) const;" );
+        out.println("        ///");
+        out.println("        /// <summery>");
+        out.println("        ///  Get the unique identifier that this object and its own");
+        out.println("        ///  Marshaler share.");
+        out.println("        /// </summery>");
+        out.println("        ///");
+        out.println("        public override byte GetDataStructureType()");
+        out.println("        {");
+        out.println("            return ID_" + getClassName().toUpperCase() + ";");
+        out.println("        }");
+        out.println("");
+//        out.println("        ///");
+//        out.println("        /// <summery>");
+//        out.println("        ///  Clone this object and return a new instance that the caller now owns.");
+//        out.println("        /// </summery>");
+//        out.println("        ///");
+//        out.println("        public override Object Clone()");
+//        out.println("        {");
+//        generateCloneBody( out );
+//        out.println("        }");
+//        out.println("");
+        out.println("        ///");
+        out.println("        /// <summery>");
+        out.println("        ///  Returns a string containing the information for this DataStructure");
+        out.println("        ///  such as its type and value of its elements.");
+        out.println("        /// </summery>");
+        out.println("        ///");
+        out.println("        public override string ToString()");
+        out.println("        {");
+        generateToStringBody( out );
+        out.println("        }");
         out.println("");
 
         generateAdditonalMembers( out );
         generatePropertyAccessors( out );
 
-        if( isComparable() ) {
-            out.println("        virtual int compareTo( const "+getClassName()+"& value ) const;");
-            out.println("");
-            out.println("        virtual bool equals( const "+getClassName()+"& value ) const;");
-            out.println("");
-            out.println("        virtual bool operator==( const "+getClassName()+"& value ) const;");
-            out.println("");
-            out.println("        virtual bool operator<( const "+getClassName()+"& value ) const;");
-            out.println("");
-        }
-
-        if( isAssignable() ) {
-            out.println("        "+getClassName()+"& operator= ( const "+getClassName()+"& other );");
-            out.println("");
-        }
-
         if( isGenIsClass() ) {
-            out.println("        /**");
-            out.println("         * @return an answer of true to the is"+getClassName()+"() query.");
-            out.println("         */");
-            out.println("        virtual bool is"+getClassName()+"() const {");
-            out.println("            return true;");
+            out.println("        ///");
+            out.println("        /// <summery>");
+            out.println("        ///  Return an answer of true to the is"+getClassName()+"() query.");
+            out.println("        /// </summery>");
+            out.println("        ///");
+            out.println("        public override bool Is"+getClassName());
+            out.println("        {");
+            out.println("            get");
+            out.println("            {");
+            out.println("                return true;");
+            out.println("            }");
             out.println("        }");
             out.println("");
         }
 
         if( getBaseClassName().equals( "BaseCommand" ) ) {
-            out.println("        /**" );
-            out.println("         * Allows a Visitor to visit this command and return a response to the" );
-            out.println("         * command based on the command type being visited.  The command will call" );
-            out.println("         * the proper processXXX method in the visitor." );
-            out.println("         * " );
-            out.println("         * @return a Response to the visitor being called or NULL if no response." );
-            out.println("         */" );
-            out.println("        virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor )" );
-            out.println("            throw( exceptions::ActiveMQException );" );
+            out.println("        ///");
+            out.println("        /// <summery>");
+            out.println("        ///  Allows a Visitor to visit this command and return a response to the" );
+            out.println("        ///  command based on the command type being visited.  The command will call" );
+            out.println("        ///  the proper processXXX method in the visitor." );
+            out.println("        /// </summery>");
+            out.println("        ///");
+            out.println("        public override Response visit( ICommandVisitor visitor )" );
+            out.println("        {");
+            generateVisitBody(out);
+            out.println("        }");
             out.println("");
         }
 
         out.println("    };");
         out.println("");
-        out.println("}}");
+        out.println("}");
         out.println("");
-        out.println("#endif /*_ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_*/");
     }
 
-    protected void populateIncludeFilesSet() {
-
-        Set<String> includes = getIncludeFiles();
+    protected void generateClassDefinition( PrintWriter out ) {
+        out.print("    public class "+getClassName()+" : " );
 
-        includes.add("<vector>");
-        includes.add("<string>");
-        includes.add("<activemq/util/Config.h>");
-        includes.add("<activemq/commands/"+getBaseClassName()+".h>");
-        includes.add("<decaf/lang/Pointer.h>");
+        out.print( getBaseClassName() );
 
-        if( isComparable() ) {
-            includes.add("<decaf/lang/Comparable.h>");
+        if( isMarshalAware() ) {
+            out.print( ", MarshallAware" );
         }
 
+        out.println();
+        out.println("    {");
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+
         for( JProperty property : getProperties() ) {
-            if( !property.getType().isPrimitiveType() &&
-                !property.getType().getSimpleName().equals("String") &&
-                !property.getType().getSimpleName().equals("ByteSequence") )
-            {
-
-                if( toHeaderFileName( property.getType() ) != null ) {
-                    includes.add(
-                        "<activemq/commands/"+toHeaderFileName( property.getType() )+".h>");
-                }
-            }
+            String type = toCSharpType(property.getType());
+            String name = decapitalize(property.getSimpleName());
+
+            out.println("        "+type+" "+name+";");
         }
     }
 
-    protected void generateNamespaceWrapper( PrintWriter out ) {
-        out.println("namespace activemq{");
-        out.println("namespace commands{");
-        out.println("");
+    protected void generateVisitBody( PrintWriter out ) {
+        out.println("            return visitor.process"+getClassName()+"( this );");
     }
 
-    protected void generateForwardDeclarations( PrintWriter out ) {
-    }
+    protected void generateToStringBody( PrintWriter out ) {
 
-    protected void generateClassDefinition( PrintWriter out ) {
-        out.print("    class AMQCPP_API "+getClassName()+" : " );
+        out.println("            return GetType().Name + \"[\" + ");
 
-        if( isComparable() ) {
-            out.println("public "+ getBaseClassName() +", public decaf::lang::Comparable<"+getClassName()+"> {" );
-        } else {
-            out.print("public "+ getBaseClassName() +" {" );
-            out.println("");
+        for( JProperty property : getProperties() ) {
+            String name = property.getSimpleName();
+
+            out.println("                \"" + name + "=\" + " + name + " + " );
         }
+
+        out.println("                \"]\";");
     }
 
-    protected void generateProperties( PrintWriter out ) {
-        out.println("    protected:");
+    protected void generateCloneBody( PrintWriter out ) {
+
+        out.println("            // Since we are a derived class use the base's Clone()");
+        out.println("            // to perform the shallow copy. Since it is shallow it");
+        out.println("            // will include our derived class. Since we are derived,");
+        out.println("            // this method is an override.");
+        out.println("            " + getClassName() + " o = (" + getClassName() + ") base.Clone();");
         out.println("");
 
         for( JProperty property : getProperties() ) {
-            String type = toCppType(property.getType());
+
+            String type = toCSharpType(property.getType());
             String name = decapitalize(property.getSimpleName());
 
-            if( !property.getType().isPrimitiveType() &&
-                !property.getType().getSimpleName().equals("ByteSequence") &&
-                !property.getType().getSimpleName().equals("String") &&
-                !type.startsWith("std::vector") ) {
+            if( property.getType().isArrayType() ) {
 
-                type = "Pointer<" + type + ">";
-            }
+            } else if( !property.getType().isPrimitiveType() ) {
 
-            out.println("        "+type+" "+name+";");
-        }
+                out.println("            if(o." + name + " != null)");
+                out.println("            {");
+                out.println("                o." + name + " = (" + type + ") o." + name + ".Clone();");
+                out.println("            }");
+                out.println("");
+            }
 
-        out.println("");
-        out.println("    public:");
-        out.println("");
-        out.println("        const static unsigned char ID_"+
-                    getClassName().toUpperCase()+" = "+getOpenWireOpCode()+";");
-        out.println("");
-        if( isComparable() ) {
-            out.println("        typedef decaf::lang::PointerComparator<"+getClassName()+"> COMPARATOR;");
-            out.println("");
         }
     }
 
-    protected void generateAdditionalConstructors( PrintWriter out ) {
-    }
-
     protected void generateAdditonalMembers( PrintWriter out ) {
     }
 
     protected void generatePropertyAccessors( PrintWriter out ) {
 
         for( JProperty property : getProperties() ) {
-            String type = toCppType(property.getType());
-            String propertyName = property.getSimpleName();
-            String parameterName = decapitalize(propertyName);
-            String constness = "";
-
-            if( !property.getType().isPrimitiveType() &&
-                !property.getType().getSimpleName().equals("ByteSequence") &&
-                !property.getType().getSimpleName().equals("String") &&
-                !type.startsWith("std::vector") ) {
-
-                    type = "Pointer<" + type + ">&";
-                    constness = "const ";
-            } else if( property.getType().getSimpleName().equals("String") ||
-                       type.startsWith("std::vector") ) {
-
-                type = type + "&";
-                constness = "const ";
-            }
-
-            if( property.getType().isPrimitiveType() ) {
-                out.println("        virtual "+type+" "+property.getGetter().getSimpleName()+"() const;");
-            } else {
-                out.println("        virtual const "+type+" "+property.getGetter().getSimpleName()+"() const;");
-                out.println("        virtual "+type+" "+property.getGetter().getSimpleName()+"();");
-            }
-
-            out.println("        virtual void "+property.getSetter().getSimpleName()+"( "+constness+type+" "+parameterName+" );");
+            String type = toCSharpType(property.getType());
+            String accessorName = property.getSimpleName();
+            String propertyName = decapitalize(accessorName);
+
+            out.println("        public " + type + " " + accessorName );
+            out.println("        {");
+            out.println("            get { return " + propertyName + "; }" );
+            out.println("            set { this." + propertyName + " = value; }");
+            out.println("        }");
             out.println("");
+
         }
     }
 
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
index 4f01948..cbacec2 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
@@ -18,8 +18,6 @@ package org.apache.activemq.nms.openwire.tool.commands;
 
 import java.io.PrintWriter;
 import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
 
 import org.codehaus.jam.JClass;
 import org.codehaus.jam.JProperty;
@@ -31,10 +29,7 @@ public abstract class CommandCodeGenerator {
     private boolean marshalAware = false;
     private String className;
     private String baseClassName;
-    private Set<String> includeFiles = new TreeSet<String>();
     private String openWireOpCode;
-    private boolean comparable = false;
-    private boolean assignable = false;
     private boolean genIsClass = false;
 
     public abstract void generate( PrintWriter out );
@@ -67,22 +62,6 @@ public abstract class CommandCodeGenerator {
         this.genIsClass = genIsClass;
     }
 
-    public boolean isComparable() {
-        return comparable;
-    }
-
-    public void setComparable(boolean comparable) {
-        this.comparable = comparable;
-    }
-
-    public boolean isAssignable() {
-        return assignable;
-    }
-
-    public void setAssignable(boolean assignable) {
-        this.assignable = assignable;
-    }
-
     public JClass getJClass() {
         return jClass;
     }
@@ -123,14 +102,6 @@ public abstract class CommandCodeGenerator {
         this.baseClassName = baseClassName;
     }
 
-    public Set<String> getIncludeFiles() {
-        return includeFiles;
-    }
-
-    public void setIncludeFiles(Set<String> includeFiles) {
-        this.includeFiles = includeFiles;
-    }
-
     public String getOpenWireOpCode() {
         return openWireOpCode;
     }
@@ -139,63 +110,41 @@ public abstract class CommandCodeGenerator {
         this.openWireOpCode = openWireOpCode;
     }
 
-    protected String toHeaderFileName( JClass type ) {
-        String name = type.getSimpleName();
-
-        if( name.equals( "String" ) ) {
-            return null;
-        } else if( type.isArrayType() ) {
-            JClass arrayClass = type.getArrayComponentType();
-            return toHeaderFileName( arrayClass );
-        } else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
-            return "BrokerError";
-        } else if( name.equals("BaseDataStructure" ) ){
-            return "DataStructure";
-        } else if( name.equals("ByteSequence") ) {
-            return "std::vector<unsigned char>";
-        } else if( !type.isPrimitiveType() ) {
-            return name;
-        } else {
-            return null;
-        }
-    }
-
-    protected String toCppType(JClass type) {
+//    protected String toFileName( JClass type ) {
+//        String name = type.getSimpleName();
+//
+//        if( name.equals( "String" ) ) {
+//            return null;
+//        } else if( type.isArrayType() ) {
+//            JClass arrayClass = type.getArrayComponentType();
+//            return toHeaderFileName( arrayClass );
+//        } else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
+//            return "BrokerError";
+//        } else if( name.equals("BaseDataStructure" ) ){
+//            return "DataStructure";
+//        } else if( name.equals("ByteSequence") ) {
+//            return "std::vector<unsigned char>";
+//        } else if( !type.isPrimitiveType() ) {
+//            return name;
+//        } else {
+//            return null;
+//        }
+//    }
+
+    protected String toCSharpType(JClass type) {
         String name = type.getSimpleName();
         if (name.equals("String")) {
-            return "std::string";
-        }
-        else if( type.isArrayType() ) {
-            if( name.equals( "byte[]" ) )
-                name = "unsigned char[]";
-
-            JClass arrayClass = type.getArrayComponentType();
-
-            if( arrayClass.isPrimitiveType() ) {
-                return "std::vector<" + name.substring( 0, name.length()-2 ) + ">";
-            } else {
-                return "std::vector< decaf::lang::Pointer<" +
-                       name.substring( 0, name.length()-2 ) + "> >";
-            }
+            return "string";
         }
         else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
             return "BrokerError";
         }
-        else if( name.equals("BaseDataStructure" ) ){
-            return "DataStructure";
-        }
         else if( name.equals("ByteSequence") ) {
-            return "std::vector<unsigned char>";
+            return "byte[]";
         }
         else if( name.equals("boolean") ) {
             return "bool";
         }
-        else if( name.equals("long") ) {
-            return "long long";
-        }
-        else if( name.equals("byte") ) {
-            return "unsigned char";
-        }
         else if( !type.isPrimitiveType() ) {
             return name;
         }
@@ -205,9 +154,9 @@ public abstract class CommandCodeGenerator {
     }
 
     /**
-     * Converts the Java type to a C++ default value
+     * Converts the Java type to a CSharp default value
      */
-    protected String toCppDefaultValue(JClass type) {
+    protected String toCSharpDefaultValue(JClass type) {
         String name = type.getSimpleName();
 
         if (name.equals("boolean")) {
@@ -215,7 +164,7 @@ public abstract class CommandCodeGenerator {
         } else if( name.equals("String") ) {
             return "\"\"";
         } else if( !type.isPrimitiveType() ) {
-            return "NULL";
+            return "null";
         } else {
             return "0";
         }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
index 64e4402..95ae4ce 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
@@ -83,11 +83,6 @@ public class CommandCodeGeneratorsFactory {
             generator = new CommandClassGenerator();
 //        }
 
-        if( className.endsWith("Id") ) {
-            generator.setComparable( true );
-            generator.setAssignable( true );
-        }
-
         if( this.commandsWithShortcuts.contains( className ) ) {
             generator.setGenIsClass( true );
         }
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
index fec0bfe..efe5a67 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
@@ -34,7 +34,7 @@ public class CommandGenerator extends MultiSourceGenerator {
     private CommandCodeGeneratorsFactory generatorsFactory =
         new CommandCodeGeneratorsFactory();
 
-    protected String targetDir="./src/main";
+    protected String targetDir="./src/main/csharp";
 
     public String getTargetDir() {
         return targetDir;
@@ -64,10 +64,10 @@ public class CommandGenerator extends MultiSourceGenerator {
     }
 
     public Object run() {
-        filePostFix = ".cpp";
+        filePostFix = ".cs";
         if (destDir == null) {
             destDir = new File(
-                targetDir+"/activemq/commands");
+                targetDir+"/Commands");
         }
 
         return super.run();
@@ -75,7 +75,7 @@ public class CommandGenerator extends MultiSourceGenerator {
 
     protected void generateClassFile() throws Exception {
 
-        File headerFile = new File(destDir, className + ".cs");
+        File headerFile = new File(destDir, className + filePostFix);
 
         CommandCodeGenerator generator = generatorsFactory.getCodeGenerator( className );
 

[activemq-nms-openwire-generator] 14/32: https://issues.apache.org/activemq/browse/AMQNET-176

Posted by df...@apache.org.
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 cd5d8bf2d43a36484a2fec9c3dbcae9ffe831a9c
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Tue Oct 27 19:59:34 2009 +0000

    https://issues.apache.org/activemq/browse/AMQNET-176
    
    Added an OnMessageRollback method to the Message to allow for the increment of the RedeliveryCounter
---
 pom.xml                                                              | 2 +-
 .../apache/activemq/nms/openwire/tool/commands/MessageGenerator.java | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index c3ad024..5669d39 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
   </mailingLists>
 
   <properties>
-    <activemq-version>5.3-SNAPSHOT</activemq-version>
+    <activemq-version>5.3.0</activemq-version>
     <projectName>Apache NMS.ActiveMQ</projectName>
     <annogen-version>0.1.0</annogen-version>
     <ant-version>1.6.2</ant-version>
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index eba6084..20edb0f 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -88,6 +88,11 @@ public class MessageGenerator extends CommandClassGenerator {
         out.println("            this.ReadOnlyBody = true;");
         out.println("        }");
         out.println("");
+        out.println("        public virtual void OnMessageRollback()" );
+        out.println("        {");
+        out.println("            this.redeliveryCounter++;" );
+        out.println("        }");
+        out.println("");
         out.println("        public bool IsExpired()");
         out.println("        {");
         out.println("            return this.expiration == 0 ? false : DateTime.UtcNow > DateUtils.ToDateTimeUtc(this.expiration);");

[activemq-nms-openwire-generator] 19/32: Includes the broker sequence Id into the ToString output.

Posted by df...@apache.org.
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 569714fa2e3c1f2de9954a7b157c88af8b1603ed
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Dec 17 16:49:46 2009 +0000

    Includes the broker sequence Id into the ToString output.
---
 .../apache/activemq/nms/openwire/tool/commands/MessageIdGenerator.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 8decc9d..e8c389f 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
@@ -53,7 +53,7 @@ public class MessageIdGenerator extends CommandClassGenerator {
 
         out.println("            if(key == null) ");
         out.println("            {");
-        out.println("                key = producerId.ToString() + \":\" + producerSequenceId;");
+        out.println("                key = producerId.ToString() + \":\" + producerSequenceId + \":\" + brokerSequenceId;");
         out.println("            }");
         out.println("            ");
         out.println("            return key;");

[activemq-nms-openwire-generator] 30/32: https://issues.apache.org/jira/browse/AMQNET-444

Posted by df...@apache.org.
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 <ta...@apache.org>
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) + \" ]\";");
+    }
+
+}

[activemq-nms-openwire-generator] 11/32: https://issues.apache.org/activemq/browse/AMQNET-193

Posted by df...@apache.org.
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 3ae3b3915b13f004ca86ba9430e26bc85000765d
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Fri Oct 9 14:47:59 2009 +0000

    https://issues.apache.org/activemq/browse/AMQNET-193
    
    Update the Message command generation to allow the ReadOnly methods to be overridden.
---
 .../nms/openwire/tool/commands/MessageGenerator.java     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index cfb3526..356b133 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -30,8 +30,8 @@ public class MessageGenerator extends CommandClassGenerator {
 
         super.generateProperties(out);
 
-        out.println("        protected bool readOnlyMsgProperties;");
-        out.println("        protected bool readOnlyMsgBody;");
+        out.println("        private bool readOnlyMsgProperties;");
+        out.println("        private bool readOnlyMsgBody;");
         out.println("");
         out.println("        public const int DEFAULT_MINIMUM_MESSAGE_SIZE = 1024;");
         out.println("");
@@ -42,16 +42,16 @@ public class MessageGenerator extends CommandClassGenerator {
 
         super.generatePropertyAccessors(out);
 
-        out.println("        public bool ReadOnlyProperties" );
+        out.println("        public virtual bool ReadOnlyProperties" );
         out.println("        {");
-        out.println("            get { return readOnlyMsgProperties; }" );
-        out.println("            set { readOnlyMsgProperties = value; }");
+        out.println("            get { return this.readOnlyMsgProperties; }" );
+        out.println("            set { this.readOnlyMsgProperties = value; }");
         out.println("        }");
         out.println("");
-        out.println("        public bool ReadOnlyBody" );
+        out.println("        public virtual bool ReadOnlyBody" );
         out.println("        {");
-        out.println("            get { return readOnlyMsgBody; }" );
-        out.println("            set { readOnlyMsgBody = value; }");
+        out.println("            get { return this.readOnlyMsgBody; }" );
+        out.println("            set { this.readOnlyMsgBody = value; }");
         out.println("        }");
         out.println("");
     }

[activemq-nms-openwire-generator] 09/32: Adds some more local properties to the Message command.

Posted by df...@apache.org.
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 3f3aab4dae78aa660487a68e73b24281cc5416c7
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Tue Sep 22 19:47:31 2009 +0000

    Adds some more local properties to the Message command.
---
 .../openwire/tool/commands/MessageGenerator.java   | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index b92fa62..0cf6382 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -29,11 +29,59 @@ public class MessageGenerator extends CommandClassGenerator {
     protected void generateProperties( PrintWriter out ) {
 
         super.generateProperties(out);
+
+        out.println("        protected bool readOnlyMsgProperties;");
+        out.println("        protected bool readOnlyMsgBody;");
+        out.println("");
+        out.println("        public const int DEFAULT_MINIMUM_MESSAGE_SIZE = 1024;");
+        out.println("");
+
+    }
+
+    protected void generatePropertyAccessors( PrintWriter out ) {
+
+        super.generatePropertyAccessors(out);
+
+        out.println("        public bool ReadOnlyProperties" );
+        out.println("        {");
+        out.println("            get { return readOnlyMsgProperties; }" );
+        out.println("            set { readOnlyMsgProperties = value; }");
+        out.println("        }");
+        out.println("");
+        out.println("        public bool ReadOnlyBody" );
+        out.println("        {");
+        out.println("            get { return readOnlyMsgBody; }" );
+        out.println("            set { readOnlyMsgBody = value; }");
+        out.println("        }");
+        out.println("");
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {
 
         super.generateAdditonalMembers( out );
+
+        out.println("        public int Size()" );
+        out.println("        {");
+        out.println("            int size = DEFAULT_MINIMUM_MESSAGE_SIZE;");
+        out.println("");
+        out.println("            if(marshalledProperties != null)");
+        out.println("            {");
+        out.println("                size += marshalledProperties.Length;");
+        out.println("            }");
+        out.println("            if(content != null)");
+        out.println("            {");
+        out.println("                size += content.Length;");
+        out.println("            }");
+        out.println("");
+        out.println("            return size;");
+        out.println("        }");
+        out.println("");
+        out.println("        public void OnSend()" );
+        out.println("        {");
+        out.println("            this.ReadOnlyProperties = true;" );
+        out.println("            this.ReadOnlyBody = true;");
+        out.println("        }");
+        out.println("");
     }
 
     protected void generateCloneBody( PrintWriter out ) {

[activemq-nms-openwire-generator] 31/32: Update project to allow for generating new versions of some commands.

Posted by df...@apache.org.
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 053156bb822501d356abc2c1da007e0748e636f3
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Aug 25 22:19:08 2014 +0000

    Update project to allow for generating new versions of some commands.
---
 pom.xml                                            | 50 +++++++++++++++++++---
 .../tool/commands/MessageDispatchGenerator.java    | 14 ++++++
 2 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 88930e1..d7efee9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>7</version>
+    <version>14</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
@@ -61,13 +61,16 @@
   </mailingLists>
 
   <properties>
-    <activemq-version>5.9-SNAPSHOT</activemq-version>
-    <projectName>Apache NMS.ActiveMQ</projectName>
     <annogen-version>0.1.0</annogen-version>
-    <ant-version>1.6.2</ant-version>
+    <ant-version>1.8.4</ant-version>
+    <activemq-version>5.10.0</activemq-version>
+    <projectName>Apache NMS.ActiveMQ</projectName>
     <xstream-version>1.4.4</xstream-version>
     <activemq-src-dir>${ACTIVEMQ_SRC_HOME}/activemq-client/</activemq-src-dir>
+    <maven-antrun-plugin-version>1.7</maven-antrun-plugin-version>
     <nms-activemq-dir>${NMS_ACTIVEMQ_HOME}</nms-activemq-dir>
+    <source-version>1.6</source-version>
+    <target-version>1.6</target-version>
   </properties>
 
   <dependencies>
@@ -81,6 +84,36 @@
       <artifactId>activemq-client</artifactId>
       <version>${activemq-version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-antrun-plugin</artifactId>
+      <version>${maven-antrun-plugin-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>groovy</groupId>
+      <artifactId>gram</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>groovy</groupId>
+      <artifactId>groovy-all</artifactId>
+      <version>1.0-jsr-03</version>
+    </dependency>
+    <dependency>
+      <groupId>annogen</groupId>
+      <artifactId>annogen</artifactId>
+      <version>${annogen-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-compiler-plugin</artifactId>
+      <version>3.1</version>
+    </dependency>
   </dependencies>
 
   <distributionManagement>
@@ -108,7 +141,6 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-antrun-plugin</artifactId>
-          <version>1.1</version>
         </plugin>
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
@@ -128,8 +160,12 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>${source-version}</source>
+          <target>${target-version}</target>
+          <optimize>true</optimize>
+          <debug>true</debug>
+          <showDeprecation>true</showDeprecation>
+          <showWarnings>true</showWarnings>
         </configuration>
       </plugin>
       <plugin>
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
index 29d0a31..17c0926 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageDispatchGenerator.java
@@ -34,6 +34,8 @@ public class MessageDispatchGenerator extends CommandClassGenerator {
     protected void generateProperties( PrintWriter out ) {
 
         out.println("        private Exception rollbackCause = null;");
+        out.println("        private long deliverySequenceId;");
+        out.println("        private object consumer;");
         out.println("");
 
         super.generateProperties(out);
@@ -46,6 +48,18 @@ public class MessageDispatchGenerator extends CommandClassGenerator {
         out.println("            set { this.rollbackCause = value; }");
         out.println("        }");
         out.println("");
+        out.println("        public long DeliverySequenceId");
+        out.println("        {");
+        out.println("            get { return this.deliverySequenceId; }");
+        out.println("            set { this.deliverySequenceId = value; }");
+        out.println("        }");
+        out.println("");
+        out.println("        public object Consumer");
+        out.println("        {");
+        out.println("            get { return this.consumer; }");
+        out.println("            set { this.consumer = value; }");
+        out.println("        }");
+        out.println("");
 
         super.generateAdditonalMembers( out );
     }

[activemq-nms-openwire-generator] 24/32: Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.

Posted by df...@apache.org.
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 83c9843e6575e842ff165d21134055f2874f2743
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Sep 1 20:14:26 2010 +0000

    Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
---
 .../tool/commands/CommandClassGenerator.java       | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index fc2c229..20c4782 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -104,6 +104,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
             out.println("            {");
             out.println("                return Equals(("+getClassName()+") that);");
             out.println("            }");
+            out.println("");
             out.println("            return false;");
             out.println("        }");
             out.println("");
@@ -202,6 +203,11 @@ public class CommandClassGenerator extends CommandCodeGenerator {
 
     protected void generateToStringBody( PrintWriter out ) {
 
+        if( getProperties().isEmpty() ) {
+            out.println("            return GetType().Name + \"[ ]\";");
+            return;
+        }
+
         out.println("            return GetType().Name + \"[ \" + ");
 
         if( getBaseClassName().equals( "BaseCommand" ) ) {
@@ -277,16 +283,19 @@ public class CommandClassGenerator extends CommandCodeGenerator {
 
     protected void generateEqualsBody( PrintWriter out ) {
 
-        for( JProperty property : getProperties() ) {
-            String accessorName = property.getSimpleName();
+        if( !getProperties().isEmpty() ) {
+            for( JProperty property : getProperties() ) {
+                String accessorName = property.getSimpleName();
 
-            out.println("            if(!Equals(this."+accessorName+", that."+accessorName+"))");
-            out.println("            {");
-            out.println("                return false;");
-            out.println("            }");
+                out.println("            if(!Equals(this."+accessorName+", that."+accessorName+"))");
+                out.println("            {");
+                out.println("                return false;");
+                out.println("            }");
+            }
+
+            out.println("");
         }
 
-        out.println("");
         out.println("            return true;");
     }
 

[activemq-nms-openwire-generator] 10/32: https://issues.apache.org/activemq/browse/AMQNET-162

Posted by df...@apache.org.
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 8bdbfa596e339c6edcabd548e6ea4fe88ee867fb
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Fri Oct 2 13:40:32 2009 +0000

    https://issues.apache.org/activemq/browse/AMQNET-162
    
    Updates for Message class generation.
---
 .../apache/activemq/nms/openwire/tool/commands/MessageGenerator.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index 0cf6382..cfb3526 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -60,7 +60,7 @@ public class MessageGenerator extends CommandClassGenerator {
 
         super.generateAdditonalMembers( out );
 
-        out.println("        public int Size()" );
+        out.println("        public virtual int Size()" );
         out.println("        {");
         out.println("            int size = DEFAULT_MINIMUM_MESSAGE_SIZE;");
         out.println("");
@@ -76,7 +76,7 @@ public class MessageGenerator extends CommandClassGenerator {
         out.println("            return size;");
         out.println("        }");
         out.println("");
-        out.println("        public void OnSend()" );
+        out.println("        public virtual void OnSend()" );
         out.println("        {");
         out.println("            this.ReadOnlyProperties = true;" );
         out.println("            this.ReadOnlyBody = true;");

[activemq-nms-openwire-generator] 02/32: Populate with the initial generators work, not complete.

Posted by df...@apache.org.
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 3a91f1059a732539b4f043190852036560c12cfd
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Tue Jul 28 13:37:48 2009 +0000

    Populate with the initial generators work, not complete.
---
 pom.xml                                            | 137 +++++++
 .../nms/openwire/tool/AmqCSharpGeneratorTask.java  | 145 +++++++
 .../tool/commands/CommandClassGenerator.java       | 293 ++++++++++++++
 .../tool/commands/CommandCodeGenerator.java        | 238 +++++++++++
 .../commands/CommandCodeGeneratorsFactory.java     |  98 +++++
 .../openwire/tool/commands/CommandGenerator.java   | 118 ++++++
 .../marshalers/AmqCSharpMarshallersGenerator.java  | 434 +++++++++++++++++++++
 7 files changed, 1463 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..6978061
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>6</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.activemq</groupId>
+  <artifactId>nms-activemq-openwire-generator</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <name>NMS.ActiveMQ Openwire Protocol Generator</name>
+  <description>Tool used to create the NMS.ActiveMQ OpenWire Commands and Marshallers.</description>
+  <inceptionYear>2009</inceptionYear>
+  <prerequisites>
+    <maven>2.0.9</maven>
+  </prerequisites>
+
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+
+  <url>http://activemq.apache.org/cms</url>
+
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+
+  <mailingLists>
+    <mailingList>
+      <name>Development List</name>
+      <subscribe>dev-subscribe@activemq.apache.org</subscribe>
+      <unsubscribe>dev-unsubscribe@activemq.apache.org</unsubscribe>
+      <post>dev@activemq.apache.org</post>
+    </mailingList>
+  </mailingLists>
+
+  <properties>
+    <activemq-version>5.3-SNAPSHOT</activemq-version>
+    <projectName>Apache NMS.ActiveMQ</projectName>
+    <annogen-version>0.1.0</annogen-version>
+    <ant-version>1.6.2</ant-version>
+    <xstream-version>1.3.1</xstream-version>
+    <activemq-core-dir>${ACTIVEMQ_SRC_HOME}/activemq-core/</activemq-core-dir>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-openwire-generator</artifactId>
+      <version>${activemq-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-core</artifactId>
+      <version>${activemq-version}</version>
+    </dependency>
+  </dependencies>
+
+  <distributionManagement>
+    <repository>
+      <id>release.apache.org</id>
+      <name>ActiveMQ-CPP Release Repository</name>
+      <url>file:///home/tabish/dev/maven2/repo/release</url>
+    </repository>
+    <snapshotRepository>
+      <id>snapshots.apache.org</id>
+      <name>ActiveMQ-CPP Snapshots Repository</name>
+      <url>file:///home/tabish/dev/maven2/repo/snapshots</url>
+    </snapshotRepository>
+  </distributionManagement>
+
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.OpenWire.Tool</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.OpenWire.Tool</developerConnection>
+    <url>http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.OpenWire.Tool</url>
+  </scm>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-antrun-plugin</artifactId>
+          <version>1.1</version>
+        </plugin>
+        <plugin>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>rat-maven-plugin</artifactId>
+          <version>1.0-alpha-3</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
new file mode 100644
index 0000000..66c8c93
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
@@ -0,0 +1,145 @@
+/**
+ *
+ * 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;
+
+import java.io.File;
+
+import org.apache.activemq.nms.openwire.tool.commands.CommandGenerator;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.codehaus.jam.JamService;
+import org.codehaus.jam.JamServiceFactory;
+import org.codehaus.jam.JamServiceParams;
+
+public class AmqCSharpGeneratorTask extends Task {
+
+    int maxVersion = 3;
+    File source = new File(".");
+    File target = new File(".");
+
+    public static void main(String[] args) {
+
+        Project project = new Project();
+        project.init();
+        AmqCSharpGeneratorTask generator = new AmqCSharpGeneratorTask();
+        generator.setProject(project);
+
+        if (args.length > 0) {
+            generator.maxVersion = Integer.parseInt(args[0]);
+            System.out.println("Generator Max Version: "
+                    + Integer.parseInt(args[0]));
+        }
+
+        if (args.length > 1) {
+            generator.source = new File(args[1]);
+            System.out.println("Generator Source: " + generator.source);
+        }
+
+        if (args.length > 2) {
+            generator.target = new File(args[2]);
+            System.out.println("Generator Source: " + generator.target);
+        }
+
+        generator.execute();
+    }
+
+    public void execute() throws BuildException {
+        try {
+
+            String sourceDir = source + "/src/main/java";
+
+            System.out.println("Parsing source files in: " + sourceDir);
+
+            JamServiceFactory jamServiceFactory = JamServiceFactory
+                    .getInstance();
+            JamServiceParams params = jamServiceFactory.createServiceParams();
+            File[] dirs = new File[] { new File(sourceDir) };
+            params.includeSourcePattern(dirs, "**/*.java");
+            JamService jam = jamServiceFactory.createService(params);
+
+            {
+                CommandGenerator script = new CommandGenerator();
+                script.setJam(jam);
+                script.setTargetDir(target + "/src/main");
+                script.setOpenwireVersion(maxVersion);
+                script.run();
+            }
+
+//            for (int i = 1; i <= maxVersion; ++i) {
+//
+//                {
+//                    AmqCppMarshallingHeadersGenerator script = new AmqCppMarshallingHeadersGenerator();
+//                    script.setJam(jam);
+//                    script.setTargetDir(target + "/src/main");
+//                    script.setOpenwireVersion(i);
+//                    script.run();
+//                }
+//                {
+//                    AmqCppMarshallingClassesGenerator script = new AmqCppMarshallingClassesGenerator();
+//                    script.setJam(jam);
+//                    script.setTargetDir(target + "/src/main");
+//                    script.setOpenwireVersion(i);
+//                    script.run();
+//                }
+//                {
+//                    AmqCppTestMarshallingHeadersGenerator script = new AmqCppTestMarshallingHeadersGenerator();
+//                    script.setJam(jam);
+//                    script.setTargetDir(target + "/src/test");
+//                    script.setOpenwireVersion(i);
+//                    script.run();
+//                }
+//                {
+//                    AmqCppTestMarshallingClassesGenerator script = new AmqCppTestMarshallingClassesGenerator();
+//                    script.setJam(jam);
+//                    script.setTargetDir(target + "/src/test");
+//                    script.setOpenwireVersion(i);
+//                    script.run();
+//                }
+//            }
+
+        } catch (Exception e) {
+            throw new BuildException(e);
+        }
+    }
+
+    public int getMaxVersion() {
+        return maxVersion;
+    }
+
+    public void setMaxVersion(int version) {
+        this.maxVersion = version;
+    }
+
+    public File getSource() {
+        return source;
+    }
+
+    public void setSource(File basedir) {
+        this.source = basedir;
+    }
+
+    public File getTarget() {
+        return target;
+    }
+
+    public void setTarget(File target) {
+        this.target = target;
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
new file mode 100644
index 0000000..9098802
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -0,0 +1,293 @@
+/**
+ * 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;
+import java.util.Set;
+
+import org.codehaus.jam.JProperty;
+
+public class CommandClassGenerator extends CommandCodeGenerator {
+
+    public void generate( PrintWriter out ) {
+
+        // Start with the license.
+        generateLicence(out);
+
+        out.println("#ifndef _ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_");
+        out.println("#define _ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_");
+        out.println("");
+        out.println("// Turn off warning message for ignored exception specification");
+        out.println("#ifdef _MSC_VER");
+        out.println("#pragma warning( disable : 4290 )");
+        out.println("#endif");
+        out.println("");
+
+        populateIncludeFilesSet();
+        for( String include : getIncludeFiles() ) {
+            if( include != null ) {
+                out.println("#include "+include);
+            }
+        }
+
+        out.println("");
+        generateNamespaceWrapper( out );
+        generateForwardDeclarations( out );
+
+        out.println("    using decaf::lang::Pointer;");
+        out.println("");
+        out.println("    /*");
+        out.println("     *");
+        out.println("     *  Command code for OpenWire format for "+getClassName() );
+        out.println("     *");
+        out.println("     *  NOTE!: This file is auto generated - do not modify!");
+        out.println("     *         if you need to make a change, please see the Java Classes");
+        out.println("     *         in the activemq-cpp-openwire-generator module");
+        out.println("     *");
+        out.println("     */");
+
+        generateClassDefinition( out );
+        generateProperties( out );
+
+        if( !isAssignable() ) {
+            out.println("    protected:");
+            out.println("");
+            out.println("        "+getClassName()+"( const "+getClassName()+"& ) : " + getBaseClassName() + "() {};");
+            out.println("        "+getClassName()+"& operator= ( const "+getClassName()+"& ) { return *this; };");
+            out.println("");
+        }
+
+        out.println("    public:");
+        out.println("");
+        out.println("        "+getClassName()+"();");
+        out.println("");
+
+        if( isAssignable() ) {
+            out.println("        "+getClassName()+"( const "+getClassName()+"& other );");
+            out.println("");
+        }
+
+        generateAdditionalConstructors( out );
+
+        out.println("        virtual ~"+getClassName()+"();");
+        out.println("");
+        out.println("        /**");
+        out.println("         * Get the unique identifier that this object and its own");
+        out.println("         * Marshaler share.");
+        out.println("         * @returns new DataStructure type copy.");
+        out.println("         */");
+        out.println("        virtual unsigned char getDataStructureType() const;");
+        out.println("");
+        out.println("        /**");
+        out.println("         * Clone this object and return a new instance that the");
+        out.println("         * caller now owns, this will be an exact copy of this one");
+        out.println("         * @returns new copy of this object.");
+        out.println("         */");
+        out.println("        virtual "+getClassName()+"* cloneDataStructure() const;");
+        out.println("");
+        out.println("        /**");
+        out.println("         * Copy the contents of the passed object into this object's");
+        out.println("         * members, overwriting any existing data.");
+        out.println("         * @param src - Source Object");
+        out.println("         */");
+        out.println("        virtual void copyDataStructure( const DataStructure* src );");
+        out.println("");
+        out.println("        /**");
+        out.println("         * Returns a string containing the information for this DataStructure");
+        out.println("         * such as its type and value of its elements.");
+        out.println("         * @return formatted string useful for debugging.");
+        out.println("         */");
+        out.println("        virtual std::string toString() const;");
+        out.println("");
+        out.println("        /**" );
+        out.println("         * Compares the DataStructure passed in to this one, and returns if" );
+        out.println("         * they are equivalent.  Equivalent here means that they are of the" );
+        out.println("         * same type, and that each element of the objects are the same." );
+        out.println("         * @returns true if DataStructure's are Equal." );
+        out.println("         */" );
+        out.println("        virtual bool equals( const DataStructure* value ) const;" );
+        out.println("");
+
+        generateAdditonalMembers( out );
+        generatePropertyAccessors( out );
+
+        if( isComparable() ) {
+            out.println("        virtual int compareTo( const "+getClassName()+"& value ) const;");
+            out.println("");
+            out.println("        virtual bool equals( const "+getClassName()+"& value ) const;");
+            out.println("");
+            out.println("        virtual bool operator==( const "+getClassName()+"& value ) const;");
+            out.println("");
+            out.println("        virtual bool operator<( const "+getClassName()+"& value ) const;");
+            out.println("");
+        }
+
+        if( isAssignable() ) {
+            out.println("        "+getClassName()+"& operator= ( const "+getClassName()+"& other );");
+            out.println("");
+        }
+
+        if( isGenIsClass() ) {
+            out.println("        /**");
+            out.println("         * @return an answer of true to the is"+getClassName()+"() query.");
+            out.println("         */");
+            out.println("        virtual bool is"+getClassName()+"() const {");
+            out.println("            return true;");
+            out.println("        }");
+            out.println("");
+        }
+
+        if( getBaseClassName().equals( "BaseCommand" ) ) {
+            out.println("        /**" );
+            out.println("         * Allows a Visitor to visit this command and return a response to the" );
+            out.println("         * command based on the command type being visited.  The command will call" );
+            out.println("         * the proper processXXX method in the visitor." );
+            out.println("         * " );
+            out.println("         * @return a Response to the visitor being called or NULL if no response." );
+            out.println("         */" );
+            out.println("        virtual Pointer<Command> visit( activemq::state::CommandVisitor* visitor )" );
+            out.println("            throw( exceptions::ActiveMQException );" );
+            out.println("");
+        }
+
+        out.println("    };");
+        out.println("");
+        out.println("}}");
+        out.println("");
+        out.println("#endif /*_ACTIVEMQ_COMMANDS_"+getClassName().toUpperCase()+"_H_*/");
+    }
+
+    protected void populateIncludeFilesSet() {
+
+        Set<String> includes = getIncludeFiles();
+
+        includes.add("<vector>");
+        includes.add("<string>");
+        includes.add("<activemq/util/Config.h>");
+        includes.add("<activemq/commands/"+getBaseClassName()+".h>");
+        includes.add("<decaf/lang/Pointer.h>");
+
+        if( isComparable() ) {
+            includes.add("<decaf/lang/Comparable.h>");
+        }
+
+        for( JProperty property : getProperties() ) {
+            if( !property.getType().isPrimitiveType() &&
+                !property.getType().getSimpleName().equals("String") &&
+                !property.getType().getSimpleName().equals("ByteSequence") )
+            {
+
+                if( toHeaderFileName( property.getType() ) != null ) {
+                    includes.add(
+                        "<activemq/commands/"+toHeaderFileName( property.getType() )+".h>");
+                }
+            }
+        }
+    }
+
+    protected void generateNamespaceWrapper( PrintWriter out ) {
+        out.println("namespace activemq{");
+        out.println("namespace commands{");
+        out.println("");
+    }
+
+    protected void generateForwardDeclarations( PrintWriter out ) {
+    }
+
+    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("");
+        }
+    }
+
+    protected void generateProperties( PrintWriter out ) {
+        out.println("    protected:");
+        out.println("");
+
+        for( JProperty property : getProperties() ) {
+            String type = toCppType(property.getType());
+            String name = decapitalize(property.getSimpleName());
+
+            if( !property.getType().isPrimitiveType() &&
+                !property.getType().getSimpleName().equals("ByteSequence") &&
+                !property.getType().getSimpleName().equals("String") &&
+                !type.startsWith("std::vector") ) {
+
+                type = "Pointer<" + type + ">";
+            }
+
+            out.println("        "+type+" "+name+";");
+        }
+
+        out.println("");
+        out.println("    public:");
+        out.println("");
+        out.println("        const static unsigned char ID_"+
+                    getClassName().toUpperCase()+" = "+getOpenWireOpCode()+";");
+        out.println("");
+        if( isComparable() ) {
+            out.println("        typedef decaf::lang::PointerComparator<"+getClassName()+"> COMPARATOR;");
+            out.println("");
+        }
+    }
+
+    protected void generateAdditionalConstructors( PrintWriter out ) {
+    }
+
+    protected void generateAdditonalMembers( PrintWriter out ) {
+    }
+
+    protected void generatePropertyAccessors( PrintWriter out ) {
+
+        for( JProperty property : getProperties() ) {
+            String type = toCppType(property.getType());
+            String propertyName = property.getSimpleName();
+            String parameterName = decapitalize(propertyName);
+            String constness = "";
+
+            if( !property.getType().isPrimitiveType() &&
+                !property.getType().getSimpleName().equals("ByteSequence") &&
+                !property.getType().getSimpleName().equals("String") &&
+                !type.startsWith("std::vector") ) {
+
+                    type = "Pointer<" + type + ">&";
+                    constness = "const ";
+            } else if( property.getType().getSimpleName().equals("String") ||
+                       type.startsWith("std::vector") ) {
+
+                type = type + "&";
+                constness = "const ";
+            }
+
+            if( property.getType().isPrimitiveType() ) {
+                out.println("        virtual "+type+" "+property.getGetter().getSimpleName()+"() const;");
+            } else {
+                out.println("        virtual const "+type+" "+property.getGetter().getSimpleName()+"() const;");
+                out.println("        virtual "+type+" "+property.getGetter().getSimpleName()+"();");
+            }
+
+            out.println("        virtual void "+property.getSetter().getSimpleName()+"( "+constness+type+" "+parameterName+" );");
+            out.println("");
+        }
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
new file mode 100644
index 0000000..4f01948
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
@@ -0,0 +1,238 @@
+/**
+ * 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;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JProperty;
+
+public abstract class CommandCodeGenerator {
+
+    private JClass jClass;
+    private List<JProperty> properties;
+    private boolean marshalAware = false;
+    private String className;
+    private String baseClassName;
+    private Set<String> includeFiles = new TreeSet<String>();
+    private String openWireOpCode;
+    private boolean comparable = false;
+    private boolean assignable = false;
+    private boolean genIsClass = false;
+
+    public abstract void generate( PrintWriter out );
+
+    protected void generateLicence(PrintWriter out) {
+        out.println("/*");
+        out.println(" * Licensed to the Apache Software Foundation (ASF) under one or more");
+        out.println(" * contributor license agreements.  See the NOTICE file distributed with");
+        out.println(" * this work for additional information regarding copyright ownership.");
+        out.println(" * The ASF licenses this file to You under the Apache License, Version 2.0");
+        out.println(" * (the \"License\"); you may not use this file except in compliance with");
+        out.println(" * the License.  You may obtain a copy of the License at");
+        out.println(" *");
+        out.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+        out.println(" *");
+        out.println(" * Unless required by applicable law or agreed to in writing, software");
+        out.println(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
+        out.println(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+        out.println(" * See the License for the specific language governing permissions and");
+        out.println(" * limitations under the License.");
+        out.println(" */");
+        out.println("");
+    }
+
+    public boolean isGenIsClass() {
+        return genIsClass;
+    }
+
+    public void setGenIsClass(boolean genIsClass) {
+        this.genIsClass = genIsClass;
+    }
+
+    public boolean isComparable() {
+        return comparable;
+    }
+
+    public void setComparable(boolean comparable) {
+        this.comparable = comparable;
+    }
+
+    public boolean isAssignable() {
+        return assignable;
+    }
+
+    public void setAssignable(boolean assignable) {
+        this.assignable = assignable;
+    }
+
+    public JClass getJClass() {
+        return jClass;
+    }
+
+    public void setJClass(JClass jClass) {
+        this.jClass = jClass;
+    }
+
+    public List<JProperty> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(List<JProperty> properties) {
+        this.properties = properties;
+    }
+
+    public boolean isMarshalAware() {
+        return marshalAware;
+    }
+
+    public void setMarshalAware(boolean marshalAware) {
+        this.marshalAware = marshalAware;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getBaseClassName() {
+        return baseClassName;
+    }
+
+    public void setBaseClassName(String baseClassName) {
+        this.baseClassName = baseClassName;
+    }
+
+    public Set<String> getIncludeFiles() {
+        return includeFiles;
+    }
+
+    public void setIncludeFiles(Set<String> includeFiles) {
+        this.includeFiles = includeFiles;
+    }
+
+    public String getOpenWireOpCode() {
+        return openWireOpCode;
+    }
+
+    public void setOpenWireOpCode(String openWireOpCode) {
+        this.openWireOpCode = openWireOpCode;
+    }
+
+    protected String toHeaderFileName( JClass type ) {
+        String name = type.getSimpleName();
+
+        if( name.equals( "String" ) ) {
+            return null;
+        } else if( type.isArrayType() ) {
+            JClass arrayClass = type.getArrayComponentType();
+            return toHeaderFileName( arrayClass );
+        } else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
+            return "BrokerError";
+        } else if( name.equals("BaseDataStructure" ) ){
+            return "DataStructure";
+        } else if( name.equals("ByteSequence") ) {
+            return "std::vector<unsigned char>";
+        } else if( !type.isPrimitiveType() ) {
+            return name;
+        } else {
+            return null;
+        }
+    }
+
+    protected String toCppType(JClass type) {
+        String name = type.getSimpleName();
+        if (name.equals("String")) {
+            return "std::string";
+        }
+        else if( type.isArrayType() ) {
+            if( name.equals( "byte[]" ) )
+                name = "unsigned char[]";
+
+            JClass arrayClass = type.getArrayComponentType();
+
+            if( arrayClass.isPrimitiveType() ) {
+                return "std::vector<" + name.substring( 0, name.length()-2 ) + ">";
+            } else {
+                return "std::vector< decaf::lang::Pointer<" +
+                       name.substring( 0, name.length()-2 ) + "> >";
+            }
+        }
+        else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
+            return "BrokerError";
+        }
+        else if( name.equals("BaseDataStructure" ) ){
+            return "DataStructure";
+        }
+        else if( name.equals("ByteSequence") ) {
+            return "std::vector<unsigned char>";
+        }
+        else if( name.equals("boolean") ) {
+            return "bool";
+        }
+        else if( name.equals("long") ) {
+            return "long long";
+        }
+        else if( name.equals("byte") ) {
+            return "unsigned char";
+        }
+        else if( !type.isPrimitiveType() ) {
+            return name;
+        }
+        else {
+            return name;
+        }
+    }
+
+    /**
+     * Converts the Java type to a C++ default value
+     */
+    protected String toCppDefaultValue(JClass type) {
+        String name = type.getSimpleName();
+
+        if (name.equals("boolean")) {
+            return "false";
+        } else if( name.equals("String") ) {
+            return "\"\"";
+        } else if( !type.isPrimitiveType() ) {
+            return "NULL";
+        } else {
+            return "0";
+        }
+    }
+
+    protected String decapitalize(String text) {
+        if (text == null) {
+            return null;
+        }
+        return text.substring(0, 1).toLowerCase() + text.substring(1);
+    }
+
+    protected String capitalize(String text) {
+        if (text == null) {
+            return null;
+        }
+        return text.substring(0, 1).toUpperCase() + text.substring(1);
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
new file mode 100644
index 0000000..64e4402
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
@@ -0,0 +1,98 @@
+/**
+ * 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.util.HashSet;
+import java.util.Set;
+
+/**
+ * Provides methods to get a Source file and Header file Code generator given a Class
+ * name.
+ *
+ * @since 2.0
+ */
+public class CommandCodeGeneratorsFactory {
+
+    private Set<String> commandsWithShortcuts;
+
+    /*
+     * Here we store all Commands that need to have a isXXX method generated
+     * such as isMessage.  We then check in the <code>checkNeedsShortcut</code>
+     * method and if the Command being generated is in this list we create a
+     * method call to override the virtual method in the base Command interface.
+     */
+    {
+        commandsWithShortcuts = new HashSet<String>();
+        commandsWithShortcuts.add( "Response" );
+        commandsWithShortcuts.add( "RemoveInfo" );
+        commandsWithShortcuts.add( "MessageDispatch" );
+        commandsWithShortcuts.add( "BrokerInfo" );
+        commandsWithShortcuts.add( "KeepAliveInfo" );
+        commandsWithShortcuts.add( "WireFormatInfo" );
+        commandsWithShortcuts.add( "Message" );
+        commandsWithShortcuts.add( "MessageAck" );
+        commandsWithShortcuts.add( "ProducerAck" );
+        commandsWithShortcuts.add( "ProducerInfo" );
+        commandsWithShortcuts.add( "MessageDispatchNotification" );
+        commandsWithShortcuts.add( "ShutdownInfo" );
+        commandsWithShortcuts.add( "TransactionInfo" );
+        commandsWithShortcuts.add( "ConnectionInfo" );
+        commandsWithShortcuts.add( "ConsumerInfo" );
+        commandsWithShortcuts.add( "RemoveSubscriptionInfo" );
+
+    }
+
+    /**
+     * Given a class name return an instance of a CSharp Class File Generator
+     * that can generate the file for the Class.
+     *
+     * @param className - name of the class to find the generator for
+     *
+     * @return a new Header File code generator.
+     */
+    public CommandCodeGenerator getCodeGenerator( String className ) {
+
+        CommandCodeGenerator generator = null;
+//        if( className.equals("Message") ) {
+//            generator = new MessageHeaderGenerator();
+//        } else if( className.equals("ConnectionId") ) {
+//            generator = new ConnectionIdHeaderGenerator();
+//        } else if( className.equals("ConsumerId") ) {
+//            generator = new ConsumerIdHeaderGenerator();
+//        } else if( className.equals("ProducerId") ) {
+//            generator = new ProducerIdHeaderGenerator();
+//        } else if( className.equals("SessionId") ) {
+//            generator = new SessionIdHeaderGenerator();
+//        } else if( className.equals("SessionInfo") ) {
+//            generator = new SessionInfoHeaderGenerator();
+//        } else {
+            generator = new CommandClassGenerator();
+//        }
+
+        if( className.endsWith("Id") ) {
+            generator.setComparable( true );
+            generator.setAssignable( true );
+        }
+
+        if( this.commandsWithShortcuts.contains( className ) ) {
+            generator.setGenIsClass( true );
+        }
+
+        return generator;
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
new file mode 100644
index 0000000..fec0bfe
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
@@ -0,0 +1,118 @@
+/**
+ * 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.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+
+import org.apache.activemq.openwire.tool.MultiSourceGenerator;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.FixCRLF;
+import org.codehaus.jam.JClass;
+
+/**
+ *
+ * @version $Revision: 409828 $
+ */
+public class CommandGenerator extends MultiSourceGenerator {
+
+    private CommandCodeGeneratorsFactory generatorsFactory =
+        new CommandCodeGeneratorsFactory();
+
+    protected String targetDir="./src/main";
+
+    public String getTargetDir() {
+        return targetDir;
+    }
+
+    public void setTargetDir(String targetDir) {
+        this.targetDir = targetDir;
+    }
+
+    protected void processClass(JClass jclass) {
+
+        // Prepare the State variables for the current class
+        simpleName = jclass.getSimpleName();
+        superclass = jclass.getSuperclass();
+        className = getClassName(jclass);
+        baseClass = getBaseClassName(jclass);
+
+        System.out.println(getClass().getName() + " processing class: " + simpleName);
+
+        try {
+            // Using the current JClass state in the MultiSourceGenerator we can
+            // now generate the Header and Source for the CSharp commands.
+            generateClassFile();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public Object run() {
+        filePostFix = ".cpp";
+        if (destDir == null) {
+            destDir = new File(
+                targetDir+"/activemq/commands");
+        }
+
+        return super.run();
+    }
+
+    protected void generateClassFile() throws Exception {
+
+        File headerFile = new File(destDir, className + ".cs");
+
+        CommandCodeGenerator generator = generatorsFactory.getCodeGenerator( className );
+
+        generator.setJClass( getJclass() );
+        generator.setProperties( getProperties() );
+        generator.setMarshalAware( isMarshallerAware() );
+        generator.setClassName( getClassName() );
+        generator.setBaseClassName( getBaseClass() );
+        generator.setOpenWireOpCode( getOpenWireOpCode(getJclass()) );
+
+        PrintWriter out = null;
+        try {
+            out = new PrintWriter(new FileWriter(headerFile));
+            generator.generate(out);
+        } catch( Exception e ) {
+            throw new RuntimeException(e);
+        } finally {
+            if( out != null ) {
+                out.close();
+            }
+        }
+
+        // Use the FixCRLF Ant Task to make sure the file has consistent
+        // newlines
+        // so that SVN does not complain on checkin.
+        Project project = new Project();
+        project.init();
+        FixCRLF fixCRLF = new FixCRLF();
+        fixCRLF.setProject(project);
+        fixCRLF.setSrcdir(headerFile.getParentFile());
+        fixCRLF.setIncludes(headerFile.getName());
+        fixCRLF.execute();
+    }
+
+    @Override
+    protected void generateFile(PrintWriter arg0) throws Exception {
+        // Not used here since we override the process method.
+    }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
new file mode 100644
index 0000000..83024c2
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
@@ -0,0 +1,434 @@
+/**
+ *
+ * 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.marshalers;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.activemq.openwire.tool.MultiSourceGenerator;
+import org.codehaus.jam.JAnnotation;
+import org.codehaus.jam.JAnnotationValue;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JProperty;
+
+/**
+ *
+ * @version $Revision: 381410 $
+ */
+public class AmqCSharpMarshallersGenerator extends MultiSourceGenerator {
+
+    protected String targetDir="./src/main";
+    protected List<JClass> concreteClasses = new ArrayList<JClass>();
+    protected File factoryFile;
+    protected String factoryFileName = "MarshallerFactory";
+    protected String indent = "    ";
+
+    /**
+     * Overrides the base class init since we don't mark any marshaller classes as
+     * being manually maintained.
+     */
+    protected void initialiseManuallyMaintainedClasses() {
+    }
+
+    /**
+     * Returns all the valid properties available on the current class. Overrides the
+     * method in {@link MultiSourceGenerator} to add filtering on the Openwire Version
+     * number so that we can rerun this tool for older versions and produce an exact
+     * match to what was previously generated.
+     *
+     * @return List of Properties valid for the current {@link JClass} and Openwire version.
+     */
+    public List<JProperty> getProperties() {
+        List<JProperty> answer = new ArrayList<JProperty>();
+        JProperty[] properties = jclass.getDeclaredProperties();
+        for (int i = 0; i < properties.length; i++) {
+            JProperty property = properties[i];
+            if (isValidProperty(property)) {
+
+                JAnnotation annotation = property.getAnnotation("openwire:property");
+                JAnnotationValue version = annotation.getValue("version");
+
+                if( version.asInt() <= this.getOpenwireVersion() ) {
+                    answer.add(property);
+                }
+            }
+        }
+        return answer;
+    }
+
+    public Object run() {
+        filePostFix = getFilePostFix();
+        if (destDir == null) {
+            destDir = new File(targetDir+"/activemq/wireformat/openwire/marshal/v"+getOpenwireVersion());
+        }
+        Object answer = super.run();
+        processFactory();
+        return answer;
+    }
+
+    protected void processClass(JClass jclass) {
+        super.processClass(jclass);
+
+        if (!jclass.isAbstract()) {
+            concreteClasses.add(jclass);
+        }
+    }
+
+    protected String getClassName(JClass jclass) {
+        return super.getClassName(jclass) + "Marshaller";
+    }
+
+    protected String getBaseClassName(JClass jclass) {
+        String answer = jclass.getSimpleName();
+
+        if( answer.equals("ActiveMQTextMessage") ) {
+            answer = "MessageMarshaller";
+        } else if( answer.equals("ActiveMQBytesMessage") ) {
+            answer = "MessageMarshaller";
+        } else if( answer.equals("ActiveMQMapMessage") ) {
+            answer = "MessageMarshaller";
+        } else if( answer.equals("ActiveMQObjectMessage") ) {
+            answer = "MessageMarshaller";
+        } else if( answer.equals("ActiveMQStreamMessage") ) {
+            answer = "MessageMarshaller";
+        } else if( answer.equals("ActiveMQBlobMessage") ) {
+            answer = "MessageMarshaller";
+        }
+
+        // We didn't map it directly so we turn it into something generic.
+        if( answer.equals( jclass.getSimpleName() ) ) {
+            answer = "BaseDataStreamMarshaller";
+            JClass superclass = jclass.getSuperclass();
+            if (superclass != null) {
+                String superName = superclass.getSimpleName();
+                if (!superName.equals("Object") && !superName.equals("JNDIBaseStorable") && !superName.equals("DataStructureSupport")) {
+                    answer = superName + "Marshaller";
+                }
+            }
+            return answer;
+        }
+
+        return answer;
+    }
+
+    public boolean isMarshallAware(JClass j) {
+
+        String answer = jclass.getSimpleName();
+
+        if( answer.equals("ActiveMQTextMessage") ) {
+            return true;
+        } else if( answer.equals("ActiveMQBytesMessage") ) {
+            return true;
+        } else if( answer.equals("ActiveMQMapMessage") ) {
+            return true;
+        } else if( answer.equals("ActiveMQObjectMessage") ) {
+            return true;
+        } else if( answer.equals("ActiveMQStreamMessage") ) {
+            return true;
+        } else if( answer.equals("ActiveMBlobMessage") ) {
+            return true;
+        } else {
+            return super.isMarshallAware(jclass);
+        }
+    }
+
+    protected String getFilePostFix() {
+        return ".h";
+    }
+
+    public String toCppType(JClass type) {
+        String name = type.getSimpleName();
+        if (name.equals("String")) {
+            return "std::string";
+        }
+        else if( type.isArrayType() ) {
+            if( name.equals( "byte[]" ) )
+                name = "unsigned char[]";
+
+            JClass arrayClass = type.getArrayComponentType();
+
+            if( arrayClass.isPrimitiveType() ) {
+                return "std::vector<" + name.substring(0, name.length()-2) + ">";
+            } else {
+                return "std::vector<" + name.substring(0, name.length()-2) + "*>";
+            }
+        }
+        else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
+            return "BrokerError";
+        }
+        else if( name.equals("BaseDataStructure" ) ){
+            return "DataStructure";
+        }
+        else if( name.equals("ByteSequence") ) {
+            return "std::vector<char>";
+        }
+        else if( name.equals("boolean") ) {
+            return "bool";
+        }
+        else if( name.equals("long") ) {
+            return "long long";
+        }
+        else if( name.equals("byte") ) {
+            return "unsigned char";
+        }
+        else if( !type.isPrimitiveType() ) {
+            return name;
+        }
+        else {
+            return name;
+        }
+    }
+
+    protected void generateLicence(PrintWriter out) {
+out.println("/*");
+out.println(" * Licensed to the Apache Software Foundation (ASF) under one or more");
+out.println(" * contributor license agreements.  See the NOTICE file distributed with");
+out.println(" * this work for additional information regarding copyright ownership.");
+out.println(" * The ASF licenses this file to You under the Apache License, Version 2.0");
+out.println(" * (the \"License\"); you may not use this file except in compliance with");
+out.println(" * the License.  You may obtain a copy of the License at");
+out.println(" *");
+out.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+out.println(" *");
+out.println(" * Unless required by applicable law or agreed to in writing, software");
+out.println(" * distributed under the License is distributed on an \"AS IS\" BASIS,");
+out.println(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+out.println(" * See the License for the specific language governing permissions and");
+out.println(" * limitations under the License.");
+out.println(" */");
+    }
+
+    protected void generateFile(PrintWriter out) throws Exception {
+        generateLicence(out);
+
+out.println("");
+out.println("#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_"+className.toUpperCase()+"_H_");
+out.println("#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_"+className.toUpperCase()+"_H_");
+out.println("");
+out.println("// Turn off warning message for ignored exception specification");
+out.println("#ifdef _MSC_VER");
+out.println("#pragma warning( disable : 4290 )");
+out.println("#endif");
+out.println("");
+
+    if( baseClass.equals("BaseDataStreamMarshaller") ) {
+        out.println("#include <activemq/wireformat/openwire/marshal/"+baseClass+".h>");
+    } else {
+        out.println("#include <activemq/wireformat/openwire/marshal/v"+getOpenwireVersion()+"/"+baseClass+".h>");
+    }
+
+out.println("");
+out.println("#include <decaf/io/DataInputStream.h>");
+out.println("#include <decaf/io/DataOutputStream.h>");
+out.println("#include <decaf/io/IOException.h>");
+out.println("#include <activemq/util/Config.h>");
+out.println("#include <activemq/commands/DataStructure.h>");
+out.println("#include <activemq/wireformat/openwire/OpenWireFormat.h>");
+out.println("#include <activemq/wireformat/openwire/utils/BooleanStream.h>");
+out.println("");
+out.println("namespace activemq{");
+out.println("namespace wireformat{");
+out.println("namespace openwire{");
+out.println("namespace marshal{");
+out.println("namespace v"+getOpenwireVersion()+"{");
+out.println("");
+out.println("    /**");
+out.println("     * Marshaling code for Open Wire Format for "+className);
+out.println("     *");
+out.println("     *  NOTE!: This file is auto generated - do not modify!");
+out.println("     *         if you need to make a change, please see the Java Classes");
+out.println("     *         in the activemq-openwire-generator module");
+out.println("     */");
+out.println("    class AMQCPP_API "+className+" : public "+baseClass+" {");
+out.println("    public:");
+out.println("");
+out.println("        "+className+"() {}");
+out.println("        virtual ~"+className+"() {}");
+out.println("");
+
+    if( !isAbstractClass() ) {
+
+out.println("        /**");
+out.println("         * Creates a new instance of this marshalable type.");
+out.println("         *");
+out.println("         * @return new DataStructure object pointer caller owns it.");
+out.println("         */");
+out.println("        virtual commands::DataStructure* createObject() const;");
+out.println("");
+out.println("        /**");
+out.println("         * Get the Data Structure Type that identifies this Marshaler");
+out.println("         *");
+out.println("         * @return byte holding the data structure type value");
+out.println("         */");
+out.println("        virtual unsigned char getDataStructureType() const;");
+out.println("");
+    }
+out.println("        /**");
+out.println("         * Un-marshal an object instance from the data input stream.");
+out.println("         *");
+out.println("         * @param wireFormat - describes the wire format of the broker.");
+out.println("         * @param dataStructure - Object to be un-marshaled.");
+out.println("         * @param dataIn - BinaryReader that provides that data.");
+out.println("         * @param bs - BooleanStream stream used to unpack bits from the wire.");
+out.println("         *");
+out.println("         * @throws IOException if an error occurs during the unmarshal.");
+out.println("         */");
+out.println("        virtual void tightUnmarshal( OpenWireFormat* wireFormat,");
+out.println("                                     commands::DataStructure* dataStructure,");
+out.println("                                     decaf::io::DataInputStream* dataIn,");
+out.println("                                     utils::BooleanStream* bs ) throw( decaf::io::IOException );");
+out.println("");
+out.println("        /**");
+out.println("         * Write the booleans that this object uses to a BooleanStream");
+out.println("         *");
+out.println("         * @param wireFormat - describes the wire format of the broker");
+out.println("         * @param dataStructure - Object to be marshaled");
+out.println("         * @param bs - BooleanStream stream used to pack bits from the wire.");
+out.println("         * @returns int value indicating the size of the marshaled object.");
+out.println("         *");
+out.println("         * @throws IOException if an error occurs during the marshal.");
+out.println("         */");
+out.println("        virtual int tightMarshal1( OpenWireFormat* wireFormat,");
+out.println("                                   commands::DataStructure* dataStructure,");
+out.println("                                   utils::BooleanStream* bs ) throw( decaf::io::IOException );");
+out.println("");
+out.println("        /**");
+out.println("         * Write a object instance to data output stream");
+out.println("         *");
+out.println("         * @param wireFormat - describes the wire format of the broker");
+out.println("         * @param dataStructure - Object to be marshaled");
+out.println("         * @param dataOut - BinaryReader that provides that data sink");
+out.println("         * @param bs - BooleanStream stream used to pack bits from the wire.");
+out.println("         *");
+out.println("         * @throws IOException if an error occurs during the marshal.");
+out.println("         */");
+out.println("        virtual void tightMarshal2( OpenWireFormat* wireFormat,");
+out.println("                                    commands::DataStructure* dataStructure,");
+out.println("                                    decaf::io::DataOutputStream* dataOut,");
+out.println("                                    utils::BooleanStream* bs ) throw( decaf::io::IOException );");
+out.println("");
+out.println("        /**");
+out.println("         * Un-marshal an object instance from the data input stream");
+out.println("         *");
+out.println("         * @param wireFormat - describes the wire format of the broker");
+out.println("         * @param dataStructure - Object to be marshaled");
+out.println("         * @param dataIn - BinaryReader that provides that data source");
+out.println("         *");
+out.println("         * @throws IOException if an error occurs during the unmarshal.");
+out.println("         */");
+out.println("        virtual void looseUnmarshal( OpenWireFormat* wireFormat,");
+out.println("                                     commands::DataStructure* dataStructure,");
+out.println("                                     decaf::io::DataInputStream* dataIn ) throw( decaf::io::IOException );");
+out.println("");
+out.println("        /**");
+out.println("         * Write a object instance to data output stream");
+out.println("         *");
+out.println("         * @param wireFormat - describs the wire format of the broker");
+out.println("         * @param dataStructure - Object to be marshaled");
+out.println("         * @param dataOut - BinaryWriter that provides that data sink");
+out.println("         *");
+out.println("         * @throws IOException if an error occurs during the marshal.");
+out.println("         */");
+out.println("        virtual void looseMarshal( OpenWireFormat* wireFormat,");
+out.println("                                   commands::DataStructure* dataStructure,");
+out.println("                                   decaf::io::DataOutputStream* dataOut ) throw( decaf::io::IOException );");
+out.println("");
+out.println("    };");
+out.println("");
+out.println("}}}}}");
+out.println("");
+out.println("#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_"+className.toUpperCase()+"_H_*/");
+out.println("");
+        }
+
+    protected void processFactory() {
+        if (factoryFile == null) {
+            factoryFile = new File(destDir, factoryFileName + filePostFix);
+        }
+        PrintWriter out = null;
+        try {
+            out = new PrintWriter(new FileWriter(factoryFile));
+            generateFactory(out);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        } finally {
+            if (out != null) {
+                out.close();
+            }
+        }
+    }
+
+    public void generateFactory(PrintWriter out) {
+        generateLicence(out);
+out.println("#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_MARSHALERFACTORY_H_");
+out.println("#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_MARSHALERFACTORY_H_");
+out.println("");
+out.println("//       Turn off warning message for ignored exception specification");
+out.println("#ifdef _MSC_VER");
+out.println("#pragma warning( disable : 4290 )");
+out.println("#endif");
+out.println("");
+out.println("#include <activemq/wireformat/openwire/OpenWireFormat.h>");
+out.println("");
+out.println("namespace activemq{");
+out.println("namespace wireformat{");
+out.println("namespace openwire{");
+out.println("namespace marshal{");
+out.println("namespace v"+getOpenwireVersion()+"{");
+out.println("");
+out.println("    /**");
+out.println("     * Used to create marshallers for a specific version of the wire");
+out.println("     * protocol.");
+out.println("     *");
+out.println("     *  NOTE!: This file is auto generated - do not modify!");
+out.println("     *         if you need to make a change, please see the Groovy scripts");
+out.println("     *         in the activemq-openwire-generator module");
+out.println("     */");
+out.println("    class MarshallerFactory {");
+out.println("    public:");
+out.println("");
+out.println("        virtual ~MarshallerFactory() {};");
+out.println("");
+out.println("        virtual void configure( OpenWireFormat* format );");
+out.println("");
+out.println("    };");
+out.println("");
+out.println("}}}}}");
+out.println("");
+out.println("#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_V"+getOpenwireVersion()+"_MARSHALLERFACTORY_H_*/");
+    }
+
+    public List<JClass> getConcreteClasses() {
+        return concreteClasses;
+    }
+
+    public void setConcreteClasses(List<JClass> concreteClasses) {
+        this.concreteClasses = concreteClasses;
+    }
+
+    public String getTargetDir() {
+        return targetDir;
+    }
+
+    public void setTargetDir(String targetDir) {
+        this.targetDir = targetDir;
+    }
+}

[activemq-nms-openwire-generator] 01/32: Rename to reflect other project names

Posted by df...@apache.org.
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 aec40e90a62d348689601a7c3c88cba6ed289e1a
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Jul 27 22:29:55 2009 +0000

    Rename to reflect other project names

[activemq-nms-openwire-generator] 13/32: Update to add an attempt at the IsExpired method needed in Message

Posted by df...@apache.org.
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 6787e107d1ca90817dd9601118b53d7c6fa70975
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Oct 22 21:36:53 2009 +0000

    Update to add an attempt at the IsExpired method needed in Message
---
 .../openwire/tool/commands/CommandClassGenerator.java  | 18 +++++++++++-------
 .../nms/openwire/tool/commands/MessageGenerator.java   | 11 +++++++++++
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 89d0aee..0ca7efc 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -27,13 +27,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         // Start with the license.
         generateLicence(out);
 
-        out.println("using System;");
-        out.println("using System.Collections;");
-
-        if( getBaseClassName().equals( "BaseCommand" ) ) {
-            out.println("");
-            out.println("using Apache.NMS.ActiveMQ.State;");
-        }
+        generateUsingDirectives(out);
 
         out.println("");
         out.println("namespace Apache.NMS.ActiveMQ.Commands");
@@ -156,6 +150,16 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         out.println("");
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        out.println("using System;");
+        out.println("using System.Collections;");
+
+        if( getBaseClassName().equals( "BaseCommand" ) ) {
+            out.println("");
+            out.println("using Apache.NMS.ActiveMQ.State;");
+        }
+    }
+
     protected void generateClassDefinition( PrintWriter out ) {
         out.print("    public class "+getClassName()+" : " );
 
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index 356b133..eba6084 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -26,6 +26,12 @@ public class MessageGenerator extends CommandClassGenerator {
         super.addAdditionalBase("MessageReference");
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        super.generateUsingDirectives(out);
+
+        out.println("using Apache.NMS.Util;");
+    }
+
     protected void generateProperties( PrintWriter out ) {
 
         super.generateProperties(out);
@@ -82,6 +88,11 @@ public class MessageGenerator extends CommandClassGenerator {
         out.println("            this.ReadOnlyBody = true;");
         out.println("        }");
         out.println("");
+        out.println("        public bool IsExpired()");
+        out.println("        {");
+        out.println("            return this.expiration == 0 ? false : DateTime.UtcNow > DateUtils.ToDateTimeUtc(this.expiration);");
+        out.println("        }");
+        out.println("");
     }
 
     protected void generateCloneBody( PrintWriter out ) {

[activemq-nms-openwire-generator] 17/32: Further refine the output of ToString.

Posted by df...@apache.org.
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 2ad3b98f42458ffa18718e017c6eb7ff3dcaf07c
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Dec 17 15:32:58 2009 +0000

    Further refine the output of ToString.
---
 .../nms/openwire/tool/commands/CommandClassGenerator.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index a768d95..22bd357 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -210,17 +210,24 @@ public class CommandClassGenerator extends CommandCodeGenerator {
         out.println("            return GetType().Name + \"[ \" + ");
 
         if( getBaseClassName().equals( "BaseCommand" ) ) {
-            out.println("                \"commandId = \" + this.CommandId + \" \" + " );
-            out.println("                \"responseRequired = \" + this.ResponseRequired + \" \" + " );
+            out.println("                \"commandId = \" + this.CommandId + \", \" + " );
+            out.println("                \"responseRequired = \" + this.ResponseRequired + \", \" + " );
         }
 
+        int size = getProperties().size();
+        int count = 0;
+
         for( JProperty property : getProperties() ) {
             String name = property.getSimpleName();
 
-            out.println("                \"" + name + " = \" + " + name + " + \" \" + " );
+            out.print("                \"" + name + " = \" + " + name + " + ");
+
+            if( ++count != size ) {
+                out.println("\", \" + ");
+            }
         }
 
-        out.println("                \"]\";");
+        out.println("\" ]\";");
     }
 
     protected void generateCloneBody( PrintWriter out ) {

[activemq-nms-openwire-generator] 27/32: fix for: https://issues.apache.org/jira/browse/AMQNET-427

Posted by df...@apache.org.
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 b78d6980b4cce4b82d94d535f84c4532d592ce1b
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Apr 18 21:03:13 2013 +0000

    fix for: https://issues.apache.org/jira/browse/AMQNET-427
---
 pom.xml                                            | 16 +++----
 .../nms/openwire/tool/AmqCSharpGeneratorTask.java  |  2 +-
 .../tool/commands/MessageAckGenerator.java         | 50 ++++++++++++++++++++++
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 97d668d..180bba8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
   <description>Tool used to create the NMS.ActiveMQ OpenWire Commands and Marshallers.</description>
   <inceptionYear>2009</inceptionYear>
   <prerequisites>
-    <maven>2.0.9</maven>
+    <maven>3.0.4</maven>
   </prerequisites>
 
   <organization>
@@ -61,12 +61,12 @@
   </mailingLists>
 
   <properties>
-    <activemq-version>5.5-SNAPSHOT</activemq-version>
+    <activemq-version>5.9-SNAPSHOT</activemq-version>
     <projectName>Apache NMS.ActiveMQ</projectName>
     <annogen-version>0.1.0</annogen-version>
     <ant-version>1.6.2</ant-version>
-    <xstream-version>1.3.1</xstream-version>
-    <activemq-core-dir>${ACTIVEMQ_SRC_HOME}/activemq-core/</activemq-core-dir>
+    <xstream-version>1.4.2</xstream-version>
+    <activemq-core-dir>${ACTIVEMQ_SRC_HOME}/activemq-client/</activemq-core-dir>
     <nms-activemq-dir>${NMS_ACTIVEMQ_HOME}</nms-activemq-dir>
   </properties>
 
@@ -78,7 +78,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-core</artifactId>
+      <artifactId>activemq-client</artifactId>
       <version>${activemq-version}</version>
     </dependency>
   </dependencies>
@@ -86,12 +86,12 @@
   <distributionManagement>
     <repository>
       <id>release.apache.org</id>
-      <name>ActiveMQ-CPP Release Repository</name>
+      <name>ActiveMQ NMS Release Repository</name>
       <url>file:///home/tabish/dev/maven2/repo/release</url>
     </repository>
     <snapshotRepository>
       <id>snapshots.apache.org</id>
-      <name>ActiveMQ-CPP Snapshots Repository</name>
+      <name>ActiveMQ NMS Snapshots Repository</name>
       <url>file:///home/tabish/dev/maven2/repo/snapshots</url>
     </snapshotRepository>
   </distributionManagement>
@@ -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="6" source="${activemq-core-dir}" target="${nms-activemq-dir}" />
+            <generate maxVersion="9" source="${activemq-core-dir}" target="${nms-activemq-dir}" />
           </tasks>
         </configuration>
       </plugin>
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
index a8d9027..b340436 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
@@ -30,7 +30,7 @@ import org.codehaus.jam.JamServiceParams;
 
 public class AmqCSharpGeneratorTask extends Task {
 
-    int maxVersion = 5;
+    int maxVersion = 9;
     File source = new File(".");
     File target = new File(".");
 
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageAckGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageAckGenerator.java
new file mode 100644
index 0000000..a1f4cde
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageAckGenerator.java
@@ -0,0 +1,50 @@
+/**
+ * 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 MessageAckGenerator extends CommandClassGenerator {
+
+    protected void generateConstructors( PrintWriter out ) {
+
+        out.println("        public "+getClassName()+"() : base()");
+        out.println("        {");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"(MessageDispatch dispatch, byte ackType, int messageCount) : base()");
+        out.println("        {");
+        out.println("            this.ackType = ackType;");
+        out.println("            this.consumerId = dispatch.ConsumerId;");
+        out.println("            this.destination = dispatch.Destination;");
+        out.println("            this.lastMessageId = dispatch.Message.MessageId;");
+        out.println("            this.messageCount = messageCount;");
+        out.println("        }");
+        out.println("");
+        out.println("        public "+getClassName()+"(Message message, byte ackType, int messageCount) : base()");
+        out.println("        {");
+        out.println("            this.ackType = ackType;");
+        out.println("            this.destination = message.Destination;");
+        out.println("            this.lastMessageId = message.MessageId;");
+        out.println("            this.messageCount = messageCount;");
+        out.println("        }");
+        out.println("");
+
+        super.generateConstructors(out);
+    }
+
+}

[activemq-nms-openwire-generator] 26/32: Fix for possible NPE in generated code.

Posted by df...@apache.org.
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 558fc0dbc5eaba8088073c317317f6952456f8c7
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Mon Nov 21 22:46:42 2011 +0000

    Fix for possible NPE in generated code.
---
 .../activemq/nms/openwire/tool/commands/CommandClassGenerator.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index ac04e97..bad5901 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -222,7 +222,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
             String name = property.getSimpleName();
 
             if( property.getType().isArrayType() && toCSharpType(property.getType()).startsWith("byte")) {
-                out.print("                \"" + name + " = \" + System.Text.ASCIIEncoding.ASCII.GetString(" + name + ") + ");
+                out.print("                \"" + name + " = \" + " + name + " ?? System.Text.ASCIIEncoding.ASCII.GetString(" + name + ") + ");
             } else {
                 out.print("                \"" + name + " = \" + " + name + " + ");
             }

[activemq-nms-openwire-generator] 06/32: Marshaler class generation now works, and some fixes to Command generation.

Posted by df...@apache.org.
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 6fb65661d424f27f4b2bb67430fdab402090b65b
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Jul 29 22:54:55 2009 +0000

    Marshaler class generation now works, and some fixes to Command generation.
---
 .../nms/openwire/tool/AmqCSharpGeneratorTask.java  |  43 +-
 .../openwire/tool/commands/SessionIdGenerator.java |   2 +-
 .../marshalers/AmqCSharpMarshallersGenerator.java  | 883 ++++++++++++++-------
 3 files changed, 630 insertions(+), 298 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
index d3b84f5..a8d9027 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
@@ -20,6 +20,7 @@ package org.apache.activemq.nms.openwire.tool;
 import java.io.File;
 
 import org.apache.activemq.nms.openwire.tool.commands.CommandGenerator;
+import org.apache.activemq.nms.openwire.tool.marshalers.AmqCSharpMarshallersGenerator;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
@@ -63,8 +64,10 @@ public class AmqCSharpGeneratorTask extends Task {
         try {
 
             String sourceDir = source + "/src/main/java";
+            String targetDir = target + "/src/main/csharp";
 
             System.out.println("Parsing source files in: " + sourceDir);
+            System.out.println("Writing resultant files in: " + targetDir);
 
             JamServiceFactory jamServiceFactory = JamServiceFactory
                     .getInstance();
@@ -76,42 +79,18 @@ public class AmqCSharpGeneratorTask extends Task {
             {
                 CommandGenerator script = new CommandGenerator();
                 script.setJam(jam);
-                script.setTargetDir(target + "/src/main/csharp");
+                script.setTargetDir(targetDir);
                 script.setOpenwireVersion(maxVersion);
                 script.run();
             }
 
-//            for (int i = 1; i <= maxVersion; ++i) {
-//
-//                {
-//                    AmqCppMarshallingHeadersGenerator script = new AmqCppMarshallingHeadersGenerator();
-//                    script.setJam(jam);
-//                    script.setTargetDir(target + "/src/main");
-//                    script.setOpenwireVersion(i);
-//                    script.run();
-//                }
-//                {
-//                    AmqCppMarshallingClassesGenerator script = new AmqCppMarshallingClassesGenerator();
-//                    script.setJam(jam);
-//                    script.setTargetDir(target + "/src/main");
-//                    script.setOpenwireVersion(i);
-//                    script.run();
-//                }
-//                {
-//                    AmqCppTestMarshallingHeadersGenerator script = new AmqCppTestMarshallingHeadersGenerator();
-//                    script.setJam(jam);
-//                    script.setTargetDir(target + "/src/test");
-//                    script.setOpenwireVersion(i);
-//                    script.run();
-//                }
-//                {
-//                    AmqCppTestMarshallingClassesGenerator script = new AmqCppTestMarshallingClassesGenerator();
-//                    script.setJam(jam);
-//                    script.setTargetDir(target + "/src/test");
-//                    script.setOpenwireVersion(i);
-//                    script.run();
-//                }
-//            }
+            for (int i = 1; i <= maxVersion; ++i) {
+                AmqCSharpMarshallersGenerator script = new AmqCSharpMarshallersGenerator();
+                script.setJam(jam);
+                script.setTargetDir(targetDir);
+                script.setOpenwireVersion(i);
+                script.run();
+            }
 
         } catch (Exception e) {
             throw new BuildException(e);
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
index 2e86d45..17b2b35 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
@@ -57,7 +57,7 @@ public class SessionIdGenerator extends CommandClassGenerator {
     }
 
     protected void generateAdditonalMembers( PrintWriter out ) {
-        out.println("        public ConnectionId getParentId");
+        out.println("        public ConnectionId ParentId");
         out.println("        {");
         out.println("            get");
         out.println("            {");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
index 83024c2..0a680af 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
@@ -21,6 +21,9 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.activemq.openwire.tool.MultiSourceGenerator;
@@ -77,7 +80,7 @@ public class AmqCSharpMarshallersGenerator extends MultiSourceGenerator {
     public Object run() {
         filePostFix = getFilePostFix();
         if (destDir == null) {
-            destDir = new File(targetDir+"/activemq/wireformat/openwire/marshal/v"+getOpenwireVersion());
+            destDir = new File(targetDir+"/OpenWire/V"+getOpenwireVersion());
         }
         Object answer = super.run();
         processFactory();
@@ -97,104 +100,40 @@ public class AmqCSharpMarshallersGenerator extends MultiSourceGenerator {
     }
 
     protected String getBaseClassName(JClass jclass) {
-        String answer = jclass.getSimpleName();
-
-        if( answer.equals("ActiveMQTextMessage") ) {
-            answer = "MessageMarshaller";
-        } else if( answer.equals("ActiveMQBytesMessage") ) {
-            answer = "MessageMarshaller";
-        } else if( answer.equals("ActiveMQMapMessage") ) {
-            answer = "MessageMarshaller";
-        } else if( answer.equals("ActiveMQObjectMessage") ) {
-            answer = "MessageMarshaller";
-        } else if( answer.equals("ActiveMQStreamMessage") ) {
-            answer = "MessageMarshaller";
-        } else if( answer.equals("ActiveMQBlobMessage") ) {
-            answer = "MessageMarshaller";
-        }
-
-        // We didn't map it directly so we turn it into something generic.
-        if( answer.equals( jclass.getSimpleName() ) ) {
-            answer = "BaseDataStreamMarshaller";
-            JClass superclass = jclass.getSuperclass();
-            if (superclass != null) {
-                String superName = superclass.getSimpleName();
-                if (!superName.equals("Object") && !superName.equals("JNDIBaseStorable") && !superName.equals("DataStructureSupport")) {
-                    answer = superName + "Marshaller";
-                }
+        String answer = "BaseDataStreamMarshaller";
+        JClass superclass = jclass.getSuperclass();
+        if (superclass != null) {
+            String superName = superclass.getSimpleName();
+            if (!superName.equals("Object") && !superName.equals("JNDIBaseStorable") && !superName.equals("DataStructureSupport")) {
+                answer = superName + "Marshaller";
             }
-            return answer;
         }
-
         return answer;
     }
 
-    public boolean isMarshallAware(JClass j) {
-
-        String answer = jclass.getSimpleName();
-
-        if( answer.equals("ActiveMQTextMessage") ) {
-            return true;
-        } else if( answer.equals("ActiveMQBytesMessage") ) {
-            return true;
-        } else if( answer.equals("ActiveMQMapMessage") ) {
-            return true;
-        } else if( answer.equals("ActiveMQObjectMessage") ) {
-            return true;
-        } else if( answer.equals("ActiveMQStreamMessage") ) {
-            return true;
-        } else if( answer.equals("ActiveMBlobMessage") ) {
-            return true;
-        } else {
-            return super.isMarshallAware(jclass);
-        }
-    }
+//    public boolean isMarshallAware(JClass j) {
+//
+//        String answer = jclass.getSimpleName();
+//
+//        if( answer.equals("ActiveMQTextMessage") ) {
+//            return true;
+//        } else if( answer.equals("ActiveMQBytesMessage") ) {
+//            return true;
+//        } else if( answer.equals("ActiveMQMapMessage") ) {
+//            return true;
+//        } else if( answer.equals("ActiveMQObjectMessage") ) {
+//            return true;
+//        } else if( answer.equals("ActiveMQStreamMessage") ) {
+//            return true;
+//        } else if( answer.equals("ActiveMBlobMessage") ) {
+//            return true;
+//        } else {
+//            return super.isMarshallAware(jclass);
+//        }
+//    }
 
     protected String getFilePostFix() {
-        return ".h";
-    }
-
-    public String toCppType(JClass type) {
-        String name = type.getSimpleName();
-        if (name.equals("String")) {
-            return "std::string";
-        }
-        else if( type.isArrayType() ) {
-            if( name.equals( "byte[]" ) )
-                name = "unsigned char[]";
-
-            JClass arrayClass = type.getArrayComponentType();
-
-            if( arrayClass.isPrimitiveType() ) {
-                return "std::vector<" + name.substring(0, name.length()-2) + ">";
-            } else {
-                return "std::vector<" + name.substring(0, name.length()-2) + "*>";
-            }
-        }
-        else if( name.equals( "Throwable" ) || name.equals( "Exception" ) ) {
-            return "BrokerError";
-        }
-        else if( name.equals("BaseDataStructure" ) ){
-            return "DataStructure";
-        }
-        else if( name.equals("ByteSequence") ) {
-            return "std::vector<char>";
-        }
-        else if( name.equals("boolean") ) {
-            return "bool";
-        }
-        else if( name.equals("long") ) {
-            return "long long";
-        }
-        else if( name.equals("byte") ) {
-            return "unsigned char";
-        }
-        else if( !type.isPrimitiveType() ) {
-            return name;
-        }
-        else {
-            return name;
-        }
+        return ".cs";
     }
 
     protected void generateLicence(PrintWriter out) {
@@ -219,146 +158,184 @@ out.println(" */");
     protected void generateFile(PrintWriter out) throws Exception {
         generateLicence(out);
 
-out.println("");
-out.println("#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_"+className.toUpperCase()+"_H_");
-out.println("#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_"+className.toUpperCase()+"_H_");
-out.println("");
-out.println("// Turn off warning message for ignored exception specification");
-out.println("#ifdef _MSC_VER");
-out.println("#pragma warning( disable : 4290 )");
-out.println("#endif");
-out.println("");
-
-    if( baseClass.equals("BaseDataStreamMarshaller") ) {
-        out.println("#include <activemq/wireformat/openwire/marshal/"+baseClass+".h>");
-    } else {
-        out.println("#include <activemq/wireformat/openwire/marshal/v"+getOpenwireVersion()+"/"+baseClass+".h>");
-    }
+        out.println("");
+        out.println("/*");
+        out.println(" *");
+        out.println(" *  Marshaler code for OpenWire format for "+super.getClassName(jclass) );
+        out.println(" *");
+        out.println(" *  NOTE!: This file is auto generated - do not modify!");
+        out.println(" *         if you need to make a change, please see the Java Classes");
+        out.println(" *         in the nms-activemq-openwire-generator module");
+        out.println(" *");
+        out.println(" */");
+        out.println("");
+        out.println("using System;");
+        out.println("using System.Collections;");
+        out.println("using System.IO;");
+        out.println("");
+        out.println("using Apache.NMS.ActiveMQ.Commands;");
+        out.println("using Apache.NMS.ActiveMQ.OpenWire;");
+        out.println("using Apache.NMS.ActiveMQ.OpenWire.V"+getOpenwireVersion()+";");
+        out.println("");
+        out.println("namespace Apache.NMS.ActiveMQ.OpenWire.V"+getOpenwireVersion());
+        out.println("{");
+        out.println("    /// <summary>");
+        out.println("    ///  Marshalling code for Open Wire Format for "+super.getClassName(jclass));
+        out.println("    /// </summary>");
+        if( isAbstractClass() ) {
+            out.println("    abstract class "+getClassName()+" : "+getBaseClass());
+        } else {
+            out.println("    class "+getClassName()+" : "+getBaseClass());
+        }
+        out.println("    {");
+
+        if (!isAbstractClass()) {
+            out.println("");
+            out.println("        public override DataStructure CreateObject() ");
+            out.println("        {");
+            out.println("            return new " + jclass.getSimpleName() + "();");
+            out.println("        }");
+            out.println("");
+            out.println("        public override byte GetDataStructureType() ");
+            out.println("        {");
+            out.println("            return " + jclass.getSimpleName() + ".ID_" + jclass.getSimpleName().toUpperCase() + ";");
+            out.println("        }");
+        }
 
-out.println("");
-out.println("#include <decaf/io/DataInputStream.h>");
-out.println("#include <decaf/io/DataOutputStream.h>");
-out.println("#include <decaf/io/IOException.h>");
-out.println("#include <activemq/util/Config.h>");
-out.println("#include <activemq/commands/DataStructure.h>");
-out.println("#include <activemq/wireformat/openwire/OpenWireFormat.h>");
-out.println("#include <activemq/wireformat/openwire/utils/BooleanStream.h>");
-out.println("");
-out.println("namespace activemq{");
-out.println("namespace wireformat{");
-out.println("namespace openwire{");
-out.println("namespace marshal{");
-out.println("namespace v"+getOpenwireVersion()+"{");
-out.println("");
-out.println("    /**");
-out.println("     * Marshaling code for Open Wire Format for "+className);
-out.println("     *");
-out.println("     *  NOTE!: This file is auto generated - do not modify!");
-out.println("     *         if you need to make a change, please see the Java Classes");
-out.println("     *         in the activemq-openwire-generator module");
-out.println("     */");
-out.println("    class AMQCPP_API "+className+" : public "+baseClass+" {");
-out.println("    public:");
-out.println("");
-out.println("        "+className+"() {}");
-out.println("        virtual ~"+className+"() {}");
-out.println("");
-
-    if( !isAbstractClass() ) {
-
-out.println("        /**");
-out.println("         * Creates a new instance of this marshalable type.");
-out.println("         *");
-out.println("         * @return new DataStructure object pointer caller owns it.");
-out.println("         */");
-out.println("        virtual commands::DataStructure* createObject() const;");
-out.println("");
-out.println("        /**");
-out.println("         * Get the Data Structure Type that identifies this Marshaler");
-out.println("         *");
-out.println("         * @return byte holding the data structure type value");
-out.println("         */");
-out.println("        virtual unsigned char getDataStructureType() const;");
-out.println("");
-    }
-out.println("        /**");
-out.println("         * Un-marshal an object instance from the data input stream.");
-out.println("         *");
-out.println("         * @param wireFormat - describes the wire format of the broker.");
-out.println("         * @param dataStructure - Object to be un-marshaled.");
-out.println("         * @param dataIn - BinaryReader that provides that data.");
-out.println("         * @param bs - BooleanStream stream used to unpack bits from the wire.");
-out.println("         *");
-out.println("         * @throws IOException if an error occurs during the unmarshal.");
-out.println("         */");
-out.println("        virtual void tightUnmarshal( OpenWireFormat* wireFormat,");
-out.println("                                     commands::DataStructure* dataStructure,");
-out.println("                                     decaf::io::DataInputStream* dataIn,");
-out.println("                                     utils::BooleanStream* bs ) throw( decaf::io::IOException );");
-out.println("");
-out.println("        /**");
-out.println("         * Write the booleans that this object uses to a BooleanStream");
-out.println("         *");
-out.println("         * @param wireFormat - describes the wire format of the broker");
-out.println("         * @param dataStructure - Object to be marshaled");
-out.println("         * @param bs - BooleanStream stream used to pack bits from the wire.");
-out.println("         * @returns int value indicating the size of the marshaled object.");
-out.println("         *");
-out.println("         * @throws IOException if an error occurs during the marshal.");
-out.println("         */");
-out.println("        virtual int tightMarshal1( OpenWireFormat* wireFormat,");
-out.println("                                   commands::DataStructure* dataStructure,");
-out.println("                                   utils::BooleanStream* bs ) throw( decaf::io::IOException );");
-out.println("");
-out.println("        /**");
-out.println("         * Write a object instance to data output stream");
-out.println("         *");
-out.println("         * @param wireFormat - describes the wire format of the broker");
-out.println("         * @param dataStructure - Object to be marshaled");
-out.println("         * @param dataOut - BinaryReader that provides that data sink");
-out.println("         * @param bs - BooleanStream stream used to pack bits from the wire.");
-out.println("         *");
-out.println("         * @throws IOException if an error occurs during the marshal.");
-out.println("         */");
-out.println("        virtual void tightMarshal2( OpenWireFormat* wireFormat,");
-out.println("                                    commands::DataStructure* dataStructure,");
-out.println("                                    decaf::io::DataOutputStream* dataOut,");
-out.println("                                    utils::BooleanStream* bs ) throw( decaf::io::IOException );");
-out.println("");
-out.println("        /**");
-out.println("         * Un-marshal an object instance from the data input stream");
-out.println("         *");
-out.println("         * @param wireFormat - describes the wire format of the broker");
-out.println("         * @param dataStructure - Object to be marshaled");
-out.println("         * @param dataIn - BinaryReader that provides that data source");
-out.println("         *");
-out.println("         * @throws IOException if an error occurs during the unmarshal.");
-out.println("         */");
-out.println("        virtual void looseUnmarshal( OpenWireFormat* wireFormat,");
-out.println("                                     commands::DataStructure* dataStructure,");
-out.println("                                     decaf::io::DataInputStream* dataIn ) throw( decaf::io::IOException );");
-out.println("");
-out.println("        /**");
-out.println("         * Write a object instance to data output stream");
-out.println("         *");
-out.println("         * @param wireFormat - describs the wire format of the broker");
-out.println("         * @param dataStructure - Object to be marshaled");
-out.println("         * @param dataOut - BinaryWriter that provides that data sink");
-out.println("         *");
-out.println("         * @throws IOException if an error occurs during the marshal.");
-out.println("         */");
-out.println("        virtual void looseMarshal( OpenWireFormat* wireFormat,");
-out.println("                                   commands::DataStructure* dataStructure,");
-out.println("                                   decaf::io::DataOutputStream* dataOut ) throw( decaf::io::IOException );");
-out.println("");
-out.println("    };");
-out.println("");
-out.println("}}}}}");
-out.println("");
-out.println("#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_"+className.toUpperCase()+"_H_*/");
-out.println("");
+        /*
+         * Generate the tight encoding marshallers
+         */
+        out.println("");
+        out.println("        // ");
+        out.println("        // Un-marshal an object instance from the data input stream");
+        out.println("        // ");
+        out.println("        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) ");
+        out.println("        {");
+        out.println("            base.TightUnmarshal(wireFormat, o, dataIn, bs);");
+
+        if (!getProperties().isEmpty() || isMarshallerAware()) {
+            out.println("");
+            out.println("            " + jclass.getSimpleName() + " info = (" + jclass.getSimpleName() + ")o;");
+        }
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.BeforeUnmarshall(wireFormat);");
+            out.println("");
         }
 
+        generateTightUnmarshalBody(out);
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.AfterUnmarshall(wireFormat);");
+        }
+
+        out.println("        }");
+        out.println("");
+        out.println("        //");
+        out.println("        // Write the booleans that this object uses to a BooleanStream");
+        out.println("        //");
+        out.println("        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)");
+        out.println("        {");
+
+        if( checkNeedsInfoPointerTM1() ) {
+            out.println("            " + jclass.getSimpleName() + " info = (" + jclass.getSimpleName() + ")o;");
+        }
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.BeforeMarshall(wireFormat);");
+        }
+
+        out.println("");
+        out.println("            int rc = base.TightMarshal1(wireFormat, o, bs);");
+
+        int baseSize = generateTightMarshal1Body(out);
+
+        out.println("");
+        out.println("            return rc + " + baseSize + ";");
+        out.println("        }");
+        out.println("");
+        out.println("        // ");
+        out.println("        // Write a object instance to data output stream");
+        out.println("        //");
+        out.println("        public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)");
+        out.println("        {");
+        out.println("            base.TightMarshal2(wireFormat, o, dataOut, bs);");
+
+        if( checkNeedsInfoPointerTM2() ) {
+            out.println("");
+            out.println("            " + jclass.getSimpleName() + " info = (" + jclass.getSimpleName() + ")o;");
+        }
+
+        generateTightMarshal2Body(out);
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.AfterMarshall(wireFormat);");
+        }
+
+        out.println("        }");
+
+        out.println("");
+        out.println("        // ");
+        out.println("        // Un-marshal an object instance from the data input stream");
+        out.println("        // ");
+        out.println("        public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn) ");
+        out.println("        {");
+        out.println("            base.LooseUnmarshal(wireFormat, o, dataIn);");
+
+        if (!getProperties().isEmpty() || isMarshallerAware()) {
+            out.println("");
+            out.println("            " + jclass.getSimpleName() + " info = (" + jclass.getSimpleName() + ")o;");
+        }
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.BeforeUnmarshall(wireFormat);");
+            out.println("");
+        }
+
+        generateLooseUnmarshalBody(out);
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.AfterUnmarshall(wireFormat);");
+        }
+
+        out.println("        }");
+        out.println("");
+        out.println("        // ");
+        out.println("        // Write a object instance to data output stream");
+        out.println("        //");
+        out.println("        public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)");
+        out.println("        {");
+
+        if (!getProperties().isEmpty() || isMarshallerAware()) {
+            out.println("");
+            out.println("            " + jclass.getSimpleName() + " info = (" + jclass.getSimpleName() + ")o;");
+        }
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.BeforeMarshall(wireFormat);");
+        }
+
+        out.println("");
+        out.println("            base.LooseMarshal(wireFormat, o, dataOut);");
+
+        generateLooseMarshalBody(out);
+
+        if (isMarshallerAware()) {
+            out.println("");
+            out.println("            info.AfterMarshall(wireFormat);");
+        }
+        out.println("        }");
+        out.println("    }");
+        out.println("}");
+    }
+
     protected void processFactory() {
         if (factoryFile == null) {
             factoryFile = new File(destDir, factoryFileName + filePostFix);
@@ -378,42 +355,51 @@ out.println("");
 
     public void generateFactory(PrintWriter out) {
         generateLicence(out);
-out.println("#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_MARSHALERFACTORY_H_");
-out.println("#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V"+getOpenwireVersion()+"_MARSHALERFACTORY_H_");
-out.println("");
-out.println("//       Turn off warning message for ignored exception specification");
-out.println("#ifdef _MSC_VER");
-out.println("#pragma warning( disable : 4290 )");
-out.println("#endif");
-out.println("");
-out.println("#include <activemq/wireformat/openwire/OpenWireFormat.h>");
-out.println("");
-out.println("namespace activemq{");
-out.println("namespace wireformat{");
-out.println("namespace openwire{");
-out.println("namespace marshal{");
-out.println("namespace v"+getOpenwireVersion()+"{");
-out.println("");
-out.println("    /**");
-out.println("     * Used to create marshallers for a specific version of the wire");
-out.println("     * protocol.");
-out.println("     *");
-out.println("     *  NOTE!: This file is auto generated - do not modify!");
-out.println("     *         if you need to make a change, please see the Groovy scripts");
-out.println("     *         in the activemq-openwire-generator module");
-out.println("     */");
-out.println("    class MarshallerFactory {");
-out.println("    public:");
-out.println("");
-out.println("        virtual ~MarshallerFactory() {};");
-out.println("");
-out.println("        virtual void configure( OpenWireFormat* format );");
-out.println("");
-out.println("    };");
-out.println("");
-out.println("}}}}}");
-out.println("");
-out.println("#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_V"+getOpenwireVersion()+"_MARSHALLERFACTORY_H_*/");
+        out.println("/*");
+        out.println(" *");
+        out.println(" *  MarshallerFactory code for OpenWire Protocol Version "+getOpenwireVersion() );
+        out.println(" *");
+        out.println(" *  NOTE!: This file is auto generated - do not modify!");
+        out.println(" *         if you need to make a change, please see the Java Classes");
+        out.println(" *         in the nms-activemq-openwire-generator module");
+        out.println(" *");
+        out.println(" */");
+        out.println("");
+        out.println("using System;");
+        out.println("using System.Collections;");
+        out.println("using System.IO;");
+        out.println("");
+        out.println("using Apache.NMS.ActiveMQ.Commands;");
+        out.println("using Apache.NMS.ActiveMQ.OpenWire;");
+        out.println("using Apache.NMS.ActiveMQ.OpenWire.V" + getOpenwireVersion() + ";");
+        out.println("");
+        out.println("namespace Apache.NMS.ActiveMQ.OpenWire.V" + getOpenwireVersion() + "");
+        out.println("{");
+        out.println("    /// <summary>");
+        out.println("    ///  Used to create marshallers for a specific version of the OpenWire protocol.");
+        out.println("    ///  Each non-abstract DataStructure object has a registered Marshaller that is");
+        out.println("    ///  created and added to the OpenWireFormat objects format collection.");
+        out.println("    /// </summary>");
+        out.println("    public class MarshallerFactory : IMarshallerFactory");
+        out.println("    {");
+        out.println("        public void configure(OpenWireFormat format) ");
+        out.println("        {");
+        out.println("            format.clearMarshallers();");
+
+        List<JClass> list = new ArrayList<JClass>(getConcreteClasses());
+        Collections.sort(list, new Comparator<JClass>() {
+            public int compare(JClass o1, JClass o2) {
+                return o1.getSimpleName().compareTo(o2.getSimpleName());
+            }
+        });
+
+        for( JClass jclass : list ) {
+            out.println("            format.addMarshaller(new " + jclass.getSimpleName() + "Marshaller());");
+        }
+
+        out.println("        }");
+        out.println("    }");
+        out.println("}");
     }
 
     public List<JClass> getConcreteClasses() {
@@ -431,4 +417,371 @@ out.println("#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_V"+getOpenwireVersio
     public void setTargetDir(String targetDir) {
         this.targetDir = targetDir;
     }
+
+    // ////////////////////////////////////////////////////////////////////////////////////
+    // This section is for the tight wire format encoding generator
+    // ////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Checks if the tightMarshal1 method needs an casted version of its
+     * dataStructure argument and then returns true or false to indicate this
+     * to the caller.
+     * @returns true if the tightMarshal1 method needs an info pointer.
+     */
+    protected boolean checkNeedsInfoPointerTM1() {
+
+        if( isMarshallerAware() ){
+            return true;
+        }
+
+        for ( JProperty property : getProperties() ) {
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+
+            if( !( type.equals("byte") ) &&
+                !( type.equals("char") ) &&
+                !( type.equals("short") ) &&
+                !( type.equals("int") ) ) {
+
+                return true;
+            }
+
+        }
+
+        return false;
+    }
+
+    /**
+     * Checks if the tightMarshal2 method needs an casted version of its
+     * dataStructure argument and then returns true or false to indicate this
+     * to the caller.
+     * @returns true if the tightMarshal2 method needs an info pointer.
+     */
+    protected boolean checkNeedsInfoPointerTM2() {
+
+        if( isMarshallerAware() ){
+            return true;
+        }
+
+        for ( JProperty property : getProperties() ) {
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+
+            if( !type.equals("boolean") ) {
+
+                return true;
+            }
+
+        }
+
+        return false;
+    }
+
+    protected void generateTightUnmarshalBody(PrintWriter out) {
+        for (JProperty property : getProperties()) {
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String propertyTypeName = propertyType.getSimpleName();
+
+            if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
+                generateTightUnmarshalBodyForArrayProperty(out, property, size);
+            } else {
+                generateTightUnmarshalBodyForProperty(out, property, size);
+            }
+        }
+    }
+
+    protected void generateTightUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+
+        String propertyName = property.getSimpleName();
+        String type = property.getType().getSimpleName();
+
+        if (type.equals("boolean")) {
+            out.println("            info." + propertyName + " = bs.ReadBoolean();");
+        } else if (type.equals("byte")) {
+            out.println("            info." + propertyName + " = dataIn.ReadByte();");
+        } else if (type.equals("char")) {
+            out.println("            info." + propertyName + " = dataIn.ReadChar();");
+        } else if (type.equals("short")) {
+            out.println("            info." + propertyName + " = dataIn.ReadInt16();");
+        } else if (type.equals("int")) {
+            out.println("            info." + propertyName + " = dataIn.ReadInt32();");
+        } else if (type.equals("long")) {
+            out.println("            info." + propertyName + " = TightUnmarshalLong(wireFormat, dataIn, bs);");
+        } else if (type.equals("String")) {
+            out.println("            info." + propertyName + " = TightUnmarshalString(dataIn, bs);");
+        } else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+            if (size != null) {
+                out.println("            info." + propertyName + " = ReadBytes(dataIn, " + size.asInt() + ");");
+            } else {
+                out.println("            info." + propertyName + " = ReadBytes(dataIn, bs.ReadBoolean());");
+            }
+        } else if (isThrowable(property.getType())) {
+            out.println("            info." + propertyName + " = TightUnmarshalBrokerError(wireFormat, dataIn, bs);");
+        } else if (isCachedProperty(property)) {
+            out.println("            info." + propertyName + " = (" + type + ") TightUnmarshalCachedObject(wireFormat, dataIn, bs);");
+        } else {
+            out.println("            info." + propertyName + " = (" + type + ") TightUnmarshalNestedObject(wireFormat, dataIn, bs);");
+        }
+    }
+
+    protected void generateTightUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+        JClass propertyType = property.getType();
+        String arrayType = propertyType.getArrayComponentType().getSimpleName();
+        String propertyName = property.getSimpleName();
+        out.println();
+        if (size != null) {
+            out.println("            {");
+            out.println("                " + arrayType + "[] value = new " + arrayType + "[" + size.asInt() + "];");
+            out.println("                " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
+            out.println("                    value[i] = (" + arrayType + ") TightUnmarshalNestedObject(wireFormat,dataIn, bs);");
+            out.println("                }");
+            out.println("                info." + propertyName + " = value;");
+            out.println("            }");
+        } else {
+            out.println("            if (bs.ReadBoolean()) {");
+            out.println("                short size = dataIn.ReadInt16();");
+            out.println("                " + arrayType + "[] value = new " + arrayType + "[size];");
+            out.println("                for( int i=0; i < size; i++ ) {");
+            out.println("                    value[i] = (" + arrayType + ") TightUnmarshalNestedObject(wireFormat,dataIn, bs);");
+            out.println("                }");
+            out.println("                info." + propertyName + " = value;");
+            out.println("            }");
+            out.println("            else {");
+            out.println("                info." + propertyName + " = null;");
+            out.println("            }");
+        }
+    }
+
+    protected int generateTightMarshal1Body(PrintWriter out) {
+        int baseSize = 0;
+        for (JProperty property : getProperties()) {
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+            String getter = "info." + property.getSimpleName();
+
+            if (type.equals("boolean")) {
+                out.println("            bs.WriteBoolean(" + getter + ");");
+            } else if (type.equals("byte")) {
+                baseSize += 1;
+            } else if (type.equals("char")) {
+                baseSize += 2;
+            } else if (type.equals("short")) {
+                baseSize += 2;
+            } else if (type.equals("int")) {
+                baseSize += 4;
+            } else if (type.equals("long")) {
+                out.println("            rc += TightMarshalLong1(wireFormat, " + getter + ", bs);");
+            } else if (type.equals("String")) {
+                out.print("");
+                out.println("            rc += TightMarshalString1(" + getter + ", bs);");
+            } else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+                if (size == null) {
+                    out.println("            bs.WriteBoolean(" + getter + "!=null);");
+                    out.println("            rc += " + getter + "==null ? 0 : " + getter + ".Length+4;");
+                } else {
+                    baseSize += size.asInt();
+                }
+            } else if (propertyType.isArrayType()) {
+                if (size != null) {
+                    out.println("            rc += TightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt() + ");");
+                } else {
+                    out.println("            rc += TightMarshalObjectArray1(wireFormat, " + getter + ", bs);");
+                }
+            } else if (isThrowable(propertyType)) {
+                out.println("            rc += TightMarshalBrokerError1(wireFormat, " + getter + ", bs);");
+            } else {
+                if (isCachedProperty(property)) {
+                    out.println("            rc += TightMarshalCachedObject1(wireFormat, (DataStructure)" + getter + ", bs);");
+                } else {
+                    out.println("        rc += TightMarshalNestedObject1(wireFormat, (DataStructure)" + getter + ", bs);");
+                }
+            }
+        }
+        return baseSize;
+    }
+
+    protected void generateTightMarshal2Body(PrintWriter out) {
+        for (JProperty property : getProperties()) {
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+            String getter = "info." + property.getSimpleName();
+
+            if (type.equals("boolean")) {
+                out.println("            bs.ReadBoolean();");
+            } else if (type.equals("byte")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("char")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("short")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("int")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("long")) {
+                out.println("            TightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);");
+            } else if (type.equals("String")) {
+                out.println("            TightMarshalString2(" + getter + ", dataOut, bs);");
+            } else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+                if (size != null) {
+                    out.println("            dataOut.Write(" + getter + ", 0, " + size.asInt() + ");");
+                } else {
+                    out.println("            if(bs.ReadBoolean()) {");
+                    out.println("                dataOut.Write(" + getter + ".Length);");
+                    out.println("                dataOut.Write(" + getter + ");");
+                    out.println("            }");
+                }
+            } else if (propertyType.isArrayType()) {
+                if (size != null) {
+                    out.println("            TightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
+                } else {
+                    out.println("            TightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);");
+                }
+            } else if (isThrowable(propertyType)) {
+                out.println("            TightMarshalBrokerError2(wireFormat, " + getter + ", dataOut, bs);");
+            } else {
+                if (isCachedProperty(property)) {
+                    out.println("            TightMarshalCachedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);");
+                } else {
+                    out.println("            TightMarshalNestedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);");
+                }
+            }
+        }
+    }
+
+    // ////////////////////////////////////////////////////////////////////////////////////
+    // This section is for the loose wire format encoding generator
+    // ////////////////////////////////////////////////////////////////////////////////////
+
+    protected void generateLooseUnmarshalBody(PrintWriter out) {
+        for (JProperty property : getProperties()) {
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String propertyTypeName = propertyType.getSimpleName();
+
+            if (propertyType.isArrayType() && !propertyTypeName.equals("byte[]")) {
+                generateLooseUnmarshalBodyForArrayProperty(out, property, size);
+            } else {
+                generateLooseUnmarshalBodyForProperty(out, property, size);
+            }
+        }
+    }
+
+    protected void generateLooseUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+
+        String propertyName = property.getSimpleName();
+        String type = property.getType().getSimpleName();
+
+        if (type.equals("boolean")) {
+            out.println("            info." + propertyName + " = dataIn.ReadBoolean();");
+        } else if (type.equals("byte")) {
+            out.println("            info." + propertyName + " = dataIn.ReadByte();");
+        } else if (type.equals("char")) {
+            out.println("            info." + propertyName + " = dataIn.ReadChar();");
+        } else if (type.equals("short")) {
+            out.println("            info." + propertyName + " = dataIn.ReadInt16();");
+        } else if (type.equals("int")) {
+            out.println("            info." + propertyName + " = dataIn.ReadInt32();");
+        } else if (type.equals("long")) {
+            out.println("            info." + propertyName + " = LooseUnmarshalLong(wireFormat, dataIn);");
+        } else if (type.equals("String")) {
+            out.println("            info." + propertyName + " = LooseUnmarshalString(dataIn);");
+        } else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+            if (size != null) {
+                out.println("            info." + propertyName + " = ReadBytes(dataIn, " + size.asInt() + ");");
+            } else {
+                out.println("            info." + propertyName + " = ReadBytes(dataIn, dataIn.ReadBoolean());");
+            }
+        } else if (isThrowable(property.getType())) {
+            out.println("            info." + propertyName + " = LooseUnmarshalBrokerError(wireFormat, dataIn);");
+        } else if (isCachedProperty(property)) {
+            out.println("            info." + propertyName + " = (" + type + ") LooseUnmarshalCachedObject(wireFormat, dataIn);");
+        } else {
+            out.println("            info." + propertyName + " = (" + type + ") LooseUnmarshalNestedObject(wireFormat, dataIn);");
+        }
+    }
+
+    protected void generateLooseUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+        JClass propertyType = property.getType();
+        String arrayType = propertyType.getArrayComponentType().getSimpleName();
+        String propertyName = property.getSimpleName();
+        out.println();
+        if (size != null) {
+            out.println("            {");
+            out.println("                " + arrayType + "[] value = new " + arrayType + "[" + size.asInt() + "];");
+            out.println("                " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
+            out.println("                    value[i] = (" + arrayType + ") LooseUnmarshalNestedObject(wireFormat,dataIn);");
+            out.println("                }");
+            out.println("                info." + propertyName + " = value;");
+            out.println("            }");
+        } else {
+            out.println("            if (dataIn.ReadBoolean()) {");
+            out.println("                short size = dataIn.ReadInt16();");
+            out.println("                " + arrayType + "[] value = new " + arrayType + "[size];");
+            out.println("                for( int i=0; i < size; i++ ) {");
+            out.println("                    value[i] = (" + arrayType + ") LooseUnmarshalNestedObject(wireFormat,dataIn);");
+            out.println("                }");
+            out.println("                info." + propertyName + " = value;");
+            out.println("            }");
+            out.println("            else {");
+            out.println("                info." + propertyName + " = null;");
+            out.println("            }");
+        }
+    }
+
+    protected void generateLooseMarshalBody(PrintWriter out) {
+        for (JProperty property : getProperties()) {
+            JAnnotation annotation = property.getAnnotation("openwire:property");
+            JAnnotationValue size = annotation.getValue("size");
+            JClass propertyType = property.getType();
+            String type = propertyType.getSimpleName();
+            String getter = "info." + property.getSimpleName();
+
+            if (type.equals("boolean")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("byte")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("char")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("short")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("int")) {
+                out.println("            dataOut.Write(" + getter + ");");
+            } else if (type.equals("long")) {
+                out.println("            LooseMarshalLong(wireFormat, " + getter + ", dataOut);");
+            } else if (type.equals("String")) {
+                out.println("            LooseMarshalString(" + getter + ", dataOut);");
+            } else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+                if (size != null) {
+                    out.println("            dataOut.Write(" + getter + ", 0, " + size.asInt() + ");");
+                } else {
+                    out.println("            dataOut.Write(" + getter + "!=null);");
+                    out.println("            if(" + getter + "!=null) {");
+                    out.println("               dataOut.Write(" + getter + ".Length);");
+                    out.println("               dataOut.Write(" + getter + ");");
+                    out.println("            }");
+                }
+            } else if (propertyType.isArrayType()) {
+                if (size != null) {
+                    out.println("            LooseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
+                } else {
+                    out.println("            LooseMarshalObjectArray(wireFormat, " + getter + ", dataOut);");
+                }
+            } else if (isThrowable(propertyType)) {
+                out.println("            LooseMarshalBrokerError(wireFormat, " + getter + ", dataOut);");
+            } else {
+                if (isCachedProperty(property)) {
+                    out.println("            LooseMarshalCachedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+                } else {
+                    out.println("            LooseMarshalNestedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+                }
+            }
+        }
+    }
+
 }

[activemq-nms-openwire-generator] 22/32: Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.

Posted by df...@apache.org.
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 636543c3de4448d6ce03e3c832e3ecdf25747208
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Sep 1 19:46:30 2010 +0000

    Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
---
 pom.xml                                                            | 4 ++--
 .../activemq/nms/openwire/tool/commands/CommandClassGenerator.java | 7 +------
 .../activemq/nms/openwire/tool/commands/MessageGenerator.java      | 2 ++
 .../activemq/nms/openwire/tool/commands/MessageIdGenerator.java    | 6 ++++++
 .../activemq/nms/openwire/tool/commands/ProducerIdGenerator.java   | 6 ++++++
 .../openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java    | 3 ---
 6 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8630e4b..97d668d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>6</version>
+    <version>7</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
@@ -61,7 +61,7 @@
   </mailingLists>
 
   <properties>
-    <activemq-version>5.4-SNAPSHOT</activemq-version>
+    <activemq-version>5.5-SNAPSHOT</activemq-version>
     <projectName>Apache NMS.ActiveMQ</projectName>
     <annogen-version>0.1.0</annogen-version>
     <ant-version>1.6.2</ant-version>
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 22bd357..4651aa2 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -122,10 +122,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
             out.println("        ///");
             out.println("        public override bool Is"+getClassName());
             out.println("        {");
-            out.println("            get");
-            out.println("            {");
-            out.println("                return true;");
-            out.println("            }");
+            out.println("            get { return true; }");
             out.println("        }");
             out.println("");
         }
@@ -151,8 +148,6 @@ public class CommandClassGenerator extends CommandCodeGenerator {
     }
 
     protected void generateUsingDirectives( PrintWriter out ) {
-        out.println("using System;");
-        out.println("using System.Collections;");
 
         if( getBaseClassName().equals( "BaseCommand" ) ) {
             out.println("");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index 20edb0f..06c244f 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -29,6 +29,8 @@ public class MessageGenerator extends CommandClassGenerator {
     protected void generateUsingDirectives( PrintWriter out ) {
         super.generateUsingDirectives(out);
 
+        out.println("using System;");
+        out.println("");
         out.println("using Apache.NMS.Util;");
     }
 
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 e8c389f..6b256db 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
@@ -28,6 +28,12 @@ public class MessageIdGenerator extends CommandClassGenerator {
         out.println("");
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        super.generateUsingDirectives(out);
+
+        out.println("using System;");
+    }
+
     protected void generateConstructors( PrintWriter out ) {
 
         out.println("        public "+getClassName()+"() : base()");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
index 8851735..e135f22 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
@@ -48,6 +48,12 @@ public class ProducerIdGenerator extends CommandClassGenerator {
         super.generateConstructors(out);
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        super.generateUsingDirectives(out);
+
+        out.println("using System;");
+    }
+
     protected void generateProperties( PrintWriter out ) {
 
         out.println("        private SessionId parentId;");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
index c27bec2..7dbc643 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
@@ -149,12 +149,9 @@ out.println(" */");
         out.println(" */");
         out.println("");
         out.println("using System;");
-        out.println("using System.Collections;");
         out.println("using System.IO;");
         out.println("");
         out.println("using Apache.NMS.ActiveMQ.Commands;");
-        out.println("using Apache.NMS.ActiveMQ.OpenWire;");
-        out.println("using Apache.NMS.ActiveMQ.OpenWire.V"+getOpenwireVersion()+";");
         out.println("");
         out.println("namespace Apache.NMS.ActiveMQ.OpenWire.V"+getOpenwireVersion());
         out.println("{");

[activemq-nms-openwire-generator] 23/32: Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.

Posted by df...@apache.org.
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 39165edc1bb0a0c96935f093788ffa43d69f2b1d
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Sep 1 20:05:52 2010 +0000

    Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
---
 .../tool/commands/CommandClassGenerator.java       | 23 +++++++++++++---------
 .../marshalers/AmqCSharpMarshallersGenerator.java  |  8 --------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 4651aa2..fc2c229 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -197,7 +197,7 @@ public class CommandClassGenerator extends CommandCodeGenerator {
     }
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.process"+getClassName()+"( this );");
+        out.println("            return visitor.process"+getClassName()+"(this);");
     }
 
     protected void generateToStringBody( PrintWriter out ) {
@@ -257,17 +257,22 @@ public class CommandClassGenerator extends CommandCodeGenerator {
     }
 
     protected void generateHashCodeBody( PrintWriter out ) {
-        out.println("            int answer = 0;");
-        out.println("");
 
-        for( JProperty property : getProperties() ) {
-            String accessorName = property.getSimpleName();
+        if( getProperties().isEmpty() ) {
+            out.println("            return HashCode(this);");
+        } else {
+            out.println("            int answer = 0;");
+            out.println("");
 
-            out.println("            answer = (answer * 37) + HashCode("+accessorName+");");
-        }
+            for( JProperty property : getProperties() ) {
+                String accessorName = property.getSimpleName();
 
-        out.println("");
-        out.println("            return answer;");
+                out.println("            answer = (answer * 37) + HashCode("+accessorName+");");
+            }
+
+            out.println("");
+            out.println("            return answer;");
+        }
     }
 
     protected void generateEqualsBody( PrintWriter out ) {
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
index 7dbc643..8fe64e2 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
@@ -343,14 +343,6 @@ out.println(" */");
         out.println(" *");
         out.println(" */");
         out.println("");
-        out.println("using System;");
-        out.println("using System.Collections;");
-        out.println("using System.IO;");
-        out.println("");
-        out.println("using Apache.NMS.ActiveMQ.Commands;");
-        out.println("using Apache.NMS.ActiveMQ.OpenWire;");
-        out.println("using Apache.NMS.ActiveMQ.OpenWire.V" + getOpenwireVersion() + ";");
-        out.println("");
         out.println("namespace Apache.NMS.ActiveMQ.OpenWire.V" + getOpenwireVersion() + "");
         out.println("{");
         out.println("    /// <summary>");

[activemq-nms-openwire-generator] 03/32: Init the SVN Ignore properties.

Posted by df...@apache.org.
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 77ddbd721d23e82d527cb42da90ce9b494e031fd
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Tue Jul 28 13:39:20 2009 +0000

    Init the SVN Ignore properties.

[activemq-nms-openwire-generator] 18/32: Add generator for BrokerId to customize the ToString method.

Posted by df...@apache.org.
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 cae624dbb91d5b94f9786dd60efe4f9126cf598c
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Thu Dec 17 15:40:04 2009 +0000

    Add generator for BrokerId to customize the ToString method.
---
 .../openwire/tool/commands/BrokerIdGenerator.java  | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/BrokerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/BrokerIdGenerator.java
new file mode 100644
index 0000000..c30b017
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/BrokerIdGenerator.java
@@ -0,0 +1,27 @@
+/**
+ * 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 BrokerIdGenerator extends CommandClassGenerator {
+
+    protected void generateToStringBody( PrintWriter out ) {
+        out.println("            return this.value;");
+    }
+
+}