Skip to content
Permalink
Browse files
Populate with the initial generators work, not complete.
  • Loading branch information
Timothy A. Bish committed Jul 28, 2009
1 parent aec40e9 commit 3a91f1059a732539b4f043190852036560c12cfd
Showing 7 changed files with 1,463 additions and 0 deletions.
137 pom.xml
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.activemq</groupId>
<artifactId>nms-activemq-openwire-generator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>NMS.ActiveMQ Openwire Protocol Generator</name>
<description>Tool used to create the NMS.ActiveMQ OpenWire Commands and Marshallers.</description>
<inceptionYear>2009</inceptionYear>
<prerequisites>
<maven>2.0.9</maven>
</prerequisites>

<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>

<url>http://activemq.apache.org/cms</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<mailingLists>
<mailingList>
<name>Development List</name>
<subscribe>dev-subscribe@activemq.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@activemq.apache.org</unsubscribe>
<post>dev@activemq.apache.org</post>
</mailingList>
</mailingLists>

<properties>
<activemq-version>5.3-SNAPSHOT</activemq-version>
<projectName>Apache NMS.ActiveMQ</projectName>
<annogen-version>0.1.0</annogen-version>
<ant-version>1.6.2</ant-version>
<xstream-version>1.3.1</xstream-version>
<activemq-core-dir>${ACTIVEMQ_SRC_HOME}/activemq-core/</activemq-core-dir>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-generator</artifactId>
<version>${activemq-version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${activemq-version}</version>
</dependency>
</dependencies>

<distributionManagement>
<repository>
<id>release.apache.org</id>
<name>ActiveMQ-CPP Release Repository</name>
<url>file:///home/tabish/dev/maven2/repo/release</url>
</repository>
<snapshotRepository>
<id>snapshots.apache.org</id>
<name>ActiveMQ-CPP Snapshots Repository</name>
<url>file:///home/tabish/dev/maven2/repo/snapshots</url>
</snapshotRepository>
</distributionManagement>

<scm>
<connection>scm:svn:https://svn.apache.org/repos/asf/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.OpenWire.Tool</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.OpenWire.Tool</developerConnection>
<url>http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.OpenWire.Tool</url>
</scm>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rat-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>

</project>
@@ -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;
}

}

0 comments on commit 3a91f10

Please sign in to comment.