activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r798698 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator: ./ src/main/java/org/apache/activemq/nms/openwire/tool/ src/main/java/org/apache/activemq/nms/openwire/tool/commands/
Date Tue, 28 Jul 2009 20:16:49 GMT
Author: tabish
Date: Tue Jul 28 20:16:49 2009
New Revision: 798698

URL: http://svn.apache.org/viewvc?rev=798698&view=rev
Log:
First workable version of Command Class generation.  Needs more work now to implement specific
Commands that require special methods and extensions.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/pom.xml
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/pom.xml?rev=798698&r1=798697&r2=798698&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/pom.xml (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/pom.xml Tue Jul 28 20:16:49
2009
@@ -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>
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java?rev=798698&r1=798697&r2=798698&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/AmqCSharpGeneratorTask.java
Tue Jul 28 20:16:49 2009
@@ -76,7 +76,7 @@
             {
                 CommandGenerator script = new CommandGenerator();
                 script.setJam(jam);
-                script.setTargetDir(target + "/src/main");
+                script.setTargetDir(target + "/src/main/csharp");
                 script.setOpenwireVersion(maxVersion);
                 script.run();
             }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java?rev=798698&r1=798697&r2=798698&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
Tue Jul 28 20:16:49 2009
@@ -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 @@
         // 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 @@
         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("");
+
         }
     }
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java?rev=798698&r1=798697&r2=798698&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGenerator.java
Tue Jul 28 20:16:49 2009
@@ -18,8 +18,6 @@
 
 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 @@
     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 @@
         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 @@
         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 @@
         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 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 toCppType(JClass type) {
+    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 @@
     }
 
     /**
-     * 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 @@
         } else if( name.equals("String") ) {
             return "\"\"";
         } else if( !type.isPrimitiveType() ) {
-            return "NULL";
+            return "null";
         } else {
             return "0";
         }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java?rev=798698&r1=798697&r2=798698&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandCodeGeneratorsFactory.java
Tue Jul 28 20:16:49 2009
@@ -83,11 +83,6 @@
             generator = new CommandClassGenerator();
 //        }
 
-        if( className.endsWith("Id") ) {
-            generator.setComparable( true );
-            generator.setAssignable( true );
-        }
-
         if( this.commandsWithShortcuts.contains( className ) ) {
             generator.setGenIsClass( true );
         }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java?rev=798698&r1=798697&r2=798698&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandGenerator.java
Tue Jul 28 20:16:49 2009
@@ -34,7 +34,7 @@
     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 Object run() {
-        filePostFix = ".cpp";
+        filePostFix = ".cs";
         if (destDir == null) {
             destDir = new File(
-                targetDir+"/activemq/commands");
+                targetDir+"/Commands");
         }
 
         return super.run();
@@ -75,7 +75,7 @@
 
     protected void generateClassFile() throws Exception {
 
-        File headerFile = new File(destDir, className + ".cs");
+        File headerFile = new File(destDir, className + filePostFix);
 
         CommandCodeGenerator generator = generatorsFactory.getCodeGenerator( className );
 



Mime
View raw message