activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r743877 - in /activemq/activemq-cpp/trunk: ./ src/main/activemq/commands/ src/main/java/org/apache/activemq/openwire/tool/
Date Thu, 12 Feb 2009 20:44:41 GMT
Author: tabish
Date: Thu Feb 12 20:44:40 2009
New Revision: 743877

URL: http://svn.apache.org/viewvc?rev=743877&view=rev
Log:
Adds generated isXXX methods to highly used commands to reduce the number of casts needed
thought the CPP code.  Add a few more commands and make some improvements to the generator
task.

Modified:
    activemq/activemq-cpp/trunk/pom.xml
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseCommand.h
    activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h
    activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.h
    activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppGeneratorTask.java
    activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java

Modified: activemq/activemq-cpp/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/pom.xml?rev=743877&r1=743876&r2=743877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/pom.xml (original)
+++ activemq/activemq-cpp/trunk/pom.xml Thu Feb 12 20:44:40 2009
@@ -117,18 +117,14 @@
 
   <build>
     <plugins>
-      <!-- Used to generate the openwire commands and marshallers -->
+      <!-- Used to generate the openwire commands and marshalers -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-antrun-plugin</artifactId>
         <configuration>
         <tasks>
-          <taskdef name="generate-v1" classname="org.apache.activemq.openwire.tool.AmqCppGeneratorTask"/>
-          <taskdef name="generate-v2" classname="org.apache.activemq.openwire.tool.AmqCppGeneratorTask"/>
-          <taskdef name="generate-v3" classname="org.apache.activemq.openwire.tool.AmqCppGeneratorTask"/>
-          <generate-v1 version="1" source="${activemq-core-dir}" target="${basedir}"/>
-          <generate-v1 version="2" source="${activemq-core-dir}" target="${basedir}"/>
-          <generate-v1 version="3" source="${activemq-core-dir}" target="${basedir}"/>
+          <taskdef name="generate" classname="org.apache.activemq.openwire.tool.AmqCppGeneratorTask"/>
+          <generate maxVersion="3" source="${activemq-core-dir}" target="${basedir}"/>
         </tasks>
         </configuration>
           <dependencies>

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseCommand.h?rev=743877&r1=743876&r2=743877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseCommand.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseCommand.h Thu Feb 12 20:44:40
2009
@@ -139,6 +139,9 @@
         virtual bool isShutdownInfo() const  {
             return false;
         }
+        virtual bool isKeepAliveInfo() const {
+            return false;
+        }
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h?rev=743877&r1=743876&r2=743877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/Command.h Thu Feb 12 20:44:40 2009
@@ -80,15 +80,16 @@
          * Command is of a certain type.  These are the most commonly used Commands
          * and we save several casts and some ugly code by just adding these here.
          */
-        virtual bool isResponse() const = 0;
-        virtual bool isMessageDispatch() const = 0;
         virtual bool isBrokerInfo() const = 0;
-        virtual bool isWireFormatInfo() const = 0;
+        virtual bool isKeepAliveInfo() const = 0;
         virtual bool isMessage() const = 0;
         virtual bool isMessageAck() const = 0;
-        virtual bool isProducerAck() const = 0;
+        virtual bool isMessageDispatch() const = 0;
         virtual bool isMessageDispatchNotification() const = 0;
+        virtual bool isProducerAck() const = 0;
+        virtual bool isResponse() const = 0;
         virtual bool isShutdownInfo() const = 0;
+        virtual bool isWireFormatInfo() const = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.h?rev=743877&r1=743876&r2=743877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.h Thu Feb 12 20:44:40
2009
@@ -97,6 +97,13 @@
         virtual bool equals( const DataStructure* value ) const;
 
         /**
+         * @return an answer of true to the isKeepAliveInfo() query.
+         */
+        virtual bool isKeepAliveInfo() const {
+            return true;
+        }
+
+        /**
          * Allows a Visitor to visit this command and return a response to the
          * command based on the command type being visited.  The command will call
          * the proper processXXX method in the visitor.

Modified: activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppGeneratorTask.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppGeneratorTask.java?rev=743877&r1=743876&r2=743877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppGeneratorTask.java
(original)
+++ activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppGeneratorTask.java
Thu Feb 12 20:44:40 2009
@@ -33,7 +33,7 @@
  */
 public class AmqCppGeneratorTask extends Task {
 
-    int version = 2;
+    int maxVersion = 3;
     File source = new File(".");
     File target = new File(".");
 
@@ -45,8 +45,8 @@
         generator.setProject(project);
 
         if( args.length > 0 ) {
-            generator.version = Integer.parseInt(args[0]);
-            System.out.println( "Generator Version: " + Integer.parseInt(args[0]) );
+            generator.maxVersion = Integer.parseInt(args[0]);
+            System.out.println( "Generator Max Version: " + Integer.parseInt(args[0]) );
         }
 
         if( args.length > 1 ) {
@@ -79,42 +79,14 @@
                 AmqCppClassesGenerator script = new AmqCppClassesGenerator();
                 script.setJam(jam);
                 script.setTargetDir(target+"/src/main");
-                script.setOpenwireVersion(version);
+                script.setOpenwireVersion(maxVersion);
                 script.run();
             }
             {
                 AmqCppHeadersGenerator script = new AmqCppHeadersGenerator();
                 script.setJam(jam);
                 script.setTargetDir(target+"/src/main");
-                script.setOpenwireVersion(version);
-                script.run();
-            }
-            {
-                AmqCppMarshallingHeadersGenerator script = new AmqCppMarshallingHeadersGenerator();
-                script.setJam(jam);
-                script.setTargetDir(target+"/src/main");
-                script.setOpenwireVersion(version);
-                script.run();
-            }
-            {
-                AmqCppMarshallingClassesGenerator script = new AmqCppMarshallingClassesGenerator();
-                script.setJam(jam);
-                script.setTargetDir(target+"/src/main");
-                script.setOpenwireVersion(version);
-                script.run();
-            }
-            {
-               AmqCppTestMarshallingHeadersGenerator script = new AmqCppTestMarshallingHeadersGenerator();
-                script.setJam(jam);
-                script.setTargetDir(target+"/src/test");
-                script.setOpenwireVersion(version);
-                script.run();
-            }
-            {
-                AmqCppTestMarshallingClassesGenerator script = new AmqCppTestMarshallingClassesGenerator();
-                script.setJam(jam);
-                script.setTargetDir(target+"/src/test");
-                script.setOpenwireVersion(version);
+                script.setOpenwireVersion(maxVersion);
                 script.run();
             }
             {
@@ -123,17 +95,49 @@
                 script.setTargetDir(target+"/src/main");
                 script.run();
             }
-            {
-                AmqCppMakefileGenerator script = new AmqCppMakefileGenerator(
-                    "activemq/wireformat/openwire/marshal/v" + version );
-                script.setTargetDir(target+"/src/main");
-                script.run();
-            }
-            {
-                AmqCppMakefileGenerator script = new AmqCppMakefileGenerator(
-                    "activemq/wireformat/openwire/marshal/v" + version );
-                script.setTargetDir(target+"/src/test");
-                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();
+                }
+                {
+                    AmqCppMakefileGenerator script = new AmqCppMakefileGenerator(
+                        "activemq/wireformat/openwire/marshal/v" + i );
+                    script.setTargetDir(target+"/src/main");
+                    script.run();
+                }
+                {
+                    AmqCppMakefileGenerator script = new AmqCppMakefileGenerator(
+                        "activemq/wireformat/openwire/marshal/v" + i );
+                    script.setTargetDir(target+"/src/test");
+                    script.run();
+                }
             }
 
         } catch (Exception e) {
@@ -141,12 +145,12 @@
         }
     }
 
-    public int getVersion() {
-        return version;
+    public int getMaxVersion() {
+        return maxVersion;
     }
 
-    public void setVersion(int version) {
-        this.version = version;
+    public void setMaxVersion(int version) {
+        this.maxVersion = version;
     }
 
     public File getSource() {

Modified: activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java?rev=743877&r1=743876&r2=743877&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/src/main/java/org/apache/activemq/openwire/tool/AmqCppHeadersGenerator.java
Thu Feb 12 20:44:40 2009
@@ -46,6 +46,7 @@
         commandsWithShortcuts.add( "Response" );
         commandsWithShortcuts.add( "MessageDispatch" );
         commandsWithShortcuts.add( "BrokerInfo" );
+        commandsWithShortcuts.add( "KeepAliveInfo" );
         commandsWithShortcuts.add( "WireFormatInfo" );
         commandsWithShortcuts.add( "Message" );
         commandsWithShortcuts.add( "MessageAck" );



Mime
View raw message