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 <[email protected]> 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>[email protected]</subscribe> + <unsubscribe>[email protected]</unsubscribe> + <post>[email protected]</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; + } +}
