db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r944880 - in /db/torque/torque4/trunk/maven-torque-generator-plugin/src: main/java/org/apache/torque/generator/ main/java/org/apache/torque/generator/maven/ test/gettingStarted/src/main/torque-gen/ test/gettingStarted/src/main/torque-gen/co...
Date Sun, 16 May 2010 16:28:19 GMT
Author: tfischer
Date: Sun May 16 16:28:18 2010
New Revision: 944880

URL: http://svn.apache.org/viewvc?rev=944880&view=rev
Log:
Adjusted to refactoring in the generator (Step 1).

Added:
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/
      - copied from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
      - copied, changed from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/
      - copied from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/conf/control.xml
      - copied, changed from r916203, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/
      - copied from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/generatorDefs/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/enumOutlets.xml
      - copied, changed from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/generatorDefs/enumGenerators.xml
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/
      - copied from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/gf/maven/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java
      - copied, changed from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/gf/maven/GettingStartedTest.java
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/maven/
      - copied from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/gf/example/gettingstarted/
Removed:
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGfMojo.java
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/generatorDefs/
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/enumGenerators.xml
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/GettingStartedTest.java
Modified:
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/classFrame.vm
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/constant.vm
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/maven/PropertyKeys.java

Copied: db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
(from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java?p2=db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java&p1=db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java&r1=910632&r2=944880&rev=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/gf/maven/TorqueGfMojo.java
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
Sun May 16 16:28:18 2010
@@ -1,4 +1,4 @@
-package org.apache.torque.gf.maven;
+package org.apache.torque.generator.maven;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -23,32 +23,110 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.Mojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
-import org.apache.torque.gf.configuration.UnitDescriptor;
-import org.apache.torque.gf.configuration.UnitDescriptor.Packaging;
-import org.apache.torque.gf.configuration.controller.Loglevel;
-import org.apache.torque.gf.configuration.option.MapOptionsConfiguration;
-import org.apache.torque.gf.configuration.option.OptionsConfiguration;
-import org.apache.torque.gf.configuration.paths.CustomProjectPaths;
-import org.apache.torque.gf.configuration.paths.DefaultTorqueGfPaths;
-import org.apache.torque.gf.configuration.paths.Maven2DirectoryProjectPaths;
-import org.apache.torque.gf.configuration.paths.Maven2JarProjectPaths;
-import org.apache.torque.gf.configuration.paths.ProjectPaths;
-import org.apache.torque.gf.control.Controller;
+import org.apache.torque.generator.configuration.UnitDescriptor;
+import org.apache.torque.generator.configuration.UnitDescriptor.Packaging;
+import org.apache.torque.generator.configuration.controller.Loglevel;
+import org.apache.torque.generator.configuration.option.MapOptionsConfiguration;
+import org.apache.torque.generator.configuration.option.OptionsConfiguration;
+import org.apache.torque.generator.configuration.paths.CustomProjectPaths;
+import org.apache.torque.generator.configuration.paths.DefaultTorqueGeneratorPaths;
+import org.apache.torque.generator.configuration.paths.Maven2DirectoryProjectPaths;
+import org.apache.torque.generator.configuration.paths.Maven2JarProjectPaths;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.control.Controller;
+import org.apache.torque.generator.file.Fileset;
 
 /**
- * Executes a unit of generation within torque-gf.
+ * Executes a unit of generation within the torque generator.
  *
  * $Id: $
  *
  * @goal generate
  */
-public class TorqueGfMojo extends AbstractMojo implements Mojo
+public class TorqueGeneratorMojo extends AbstractMojo implements Mojo
 {
+    private enum TargetDirUsage
+    {
+        /** 
+         * The target dir will be added to the maven project's 
+         * compileSourceRoot.
+         */
+        COMPILE("compile"),
+        /** 
+         * The target dir will be added to the maven project's 
+         * testCompileSourceRoot.
+         */
+        TEST_COMPILE("test-compile"),
+        /** 
+         * The target dir will be added to the maven project's resources.
+         */
+        RESOURCE("resource"),
+        /** 
+         * The target dir will be added to the maven project's test resources.
+         */
+        TEST_RESOURCE("test-resource"),
+        /** 
+         * The target dir will not be used in the maven build.
+         */
+        NONE("none");
+        
+        private String key;
+        
+        /**
+         * Constructor.
+         *
+         * @param key the key for the enum.
+         */
+        private TargetDirUsage(String key)
+        {
+            this.key = key;
+        }
+        
+        @Override
+        public String toString()
+        {
+            return key;
+        }
+        
+        /**
+         * Returns the key of the Usage.
+         * 
+         * @return the key, not null.
+         */
+        public String getKey()
+        {
+            return key;
+        }
+        
+        public static TargetDirUsage get(String key) 
+            throws MojoExecutionException
+        {
+            for (TargetDirUsage candidate : values())
+            {
+                if (candidate.getKey().equals(key))
+                {
+                    return candidate;
+                }
+            }
+            StringBuilder errorMessage = new StringBuilder()
+                .append("targetDirUsage contains illegal value: ")
+                .append(key)
+                .append(". Possible values are :");
+            for (TargetDirUsage targetDirUsage: values())
+            {
+                errorMessage.append(" ").append(targetDirUsage.getKey());
+            }
+            throw new MojoExecutionException(errorMessage.toString());
+        }
+    }
+    
     /**
      * The packaging type of the generation unit, either "directory" , "jar"
      * or "classpath".
@@ -89,6 +167,28 @@ public class TorqueGfMojo extends Abstra
      * @parameter
      */
     private File sourceDir;
+    
+    /**
+     * Include patterns for the source files.
+     * If set, the include and exclude patterns from the templates
+     * are overridden.
+     * If not set, then the include patterns from the templates are used.
+     * The patterns are case sensitive, wildcards are * and ?.
+     * 
+     * @parameter
+     */
+    private Set<String> sourceIncludes;
+
+    /**
+     * Exclude patterns for the source files.
+     * If set, the include and exclude patterns from the templates
+     * are overridden.
+     * If not set, then the include patterns from the templates are used.
+     * The patterns are case sensitive, wildcards are * and ?.
+     * 
+     * @parameter
+     */
+    private Set<String> sourceExcludes;
 
     /**
      * The target directory for files which are generated each time anew.
@@ -100,7 +200,7 @@ public class TorqueGfMojo extends Abstra
     /**
      * The target directory for files which are not generated each time anew.
      *
-     * @parameter expression="${basedir}/src/main/generated-sources"
+     * @parameter expression="${basedir}/src/main/generated-java"
      */
     private File modifiedFileTargetDir;
 
@@ -113,24 +213,76 @@ public class TorqueGfMojo extends Abstra
     private String jarFile;
 
     /**
-     * Whether the generated files in newFileTargetDir should be treated
-     * as compileable sources.
+     * What to do with the generated files in newFileTargetDir.
+     * Possible values are:
+     * <ul>
+     *   <li>
+     *     compile: The generated files are treated as compileable sources.
+     *     In maven-speak, this means the newFileTargetDir will be added as
+     *     compileSourceRoot of the maven project.
+     *   </li>
+     *   <li>
+     *     test-compile: The generated files are treated as compileable 
+     *     test sources.
+     *     In maven-speak, this means the newFileTargetDir will be added as
+     *     testCompileSourceRoot of the maven project.
+     *   </li>
+     *   <li>
+     *     resource: The generated files are treated as resource.
+     *     This means the newFileTargetDir will be added to the
+     *     resources of the maven project.
+     *   </li>
+     *   <li>
+     *     test-resource: The generated files are treated as test resource.
+     *     This means the newFileTargetDir will be added to the
+     *     test resources of the maven project.
+     *   </li>
+     *   <li>
+     *     none: The generated files are not used in the maven build.
+     *   </li>
      *
-     * @parameter expression="true"
+     * @parameter expression="compile"
+     * @required
      */
-    private boolean compileNewFileTargetDir;
+    private String newFileTargetDirUsage;
 
     /**
-     * Whether the generated files in modifiedFileTargetDir should be treated
-     * as compileable sources.
+     * What to do with the generated files in modifiedFileTargetDir.
+     * Possible values are:
+     * <ul>
+     *   <li>
+     *     compile: The generated files are treated as compileable sources.
+     *     In maven-speak, this means the modifiedFileTargetDir will be added
+     *     as compileSourceRoot of the maven project.
+     *   </li>
+     *   <li>
+     *     test-compile: The generated files are treated as compileable 
+     *     test sources.
+     *     In maven-speak, this means the modifiedFileTargetDir will be added
+     *     as testCompileSourceRoot of the maven project.
+     *   </li>
+     *   <li>
+     *     resource: The generated files are treated as resource.
+     *     This means the modifiedFileTargetDir will be added to the
+     *     resources of the maven project.
+     *   </li>
+     *   <li>
+     *     test-resource: The generated files are treated as test resource.
+     *     This means the modifiedFileTargetDir will be added to the
+     *     test resources of the maven project.
+     *   </li>
+     *   <li>
+     *     none: The generated files are not used in the maven build.
+     *   </li>
      *
-     * @parameter expression="true"
+     * @parameter expression="compile"
+     * @required
      */
-    private boolean compileModifiedFileTargetDir;
+    private String modifiedFileTargetDirUsage;
 
     /**
      * The config directory of the project overriding the settings.
-     * Then, the settings of this directory are used as "child"
+     * If set, the settings of this directory are used as "child"
      * and the "normal" settings are used as "parent".
      *
      * @parameter
@@ -147,7 +299,7 @@ public class TorqueGfMojo extends Abstra
 
     /**
      * Additional options which can be added to the generation process.
-     * This overrides any existing options.
+     * This overrides existing options.
      *
      * @parameter
      */
@@ -167,6 +319,12 @@ public class TorqueGfMojo extends Abstra
         Controller controller = new Controller();
         List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>();
 
+        // Do conversion here so illegal values are discovered before generation
+        TargetDirUsage newFileTargetDirUsageConverted
+                = TargetDirUsage.get(newFileTargetDirUsage);
+        TargetDirUsage modifiedFileTargetDirUsageConverted
+                = TargetDirUsage.get(modifiedFileTargetDirUsage);
+        
         UnitDescriptor.Packaging packaging;
         if ("jar".equals(this.packaging))
         {
@@ -184,7 +342,7 @@ public class TorqueGfMojo extends Abstra
         {
             throw new IllegalArgumentException(
                     "Unknown packaging " + this.packaging
-                        + ", must be either jar or directory");
+                        + ", must be jar, directory or classpath");
         }
         getLog().debug("Packaging is " + packaging);
 
@@ -237,6 +395,16 @@ public class TorqueGfMojo extends Abstra
             getLog().debug("Setting source dir to " + sourceDir.toString());
         }
 
+        Fileset sourceFileset = null;
+        if (sourceIncludes != null || sourceExcludes != null)
+        {
+            sourceFileset = new Fileset(null, sourceIncludes, sourceExcludes);
+            getLog().debug("Setting source includes to " 
+                    + sourceIncludes);
+            getLog().debug("Setting source excludes to " 
+                    + sourceExcludes);
+        }
+
         if (newFileTargetDir != null)
         {
             projectPaths.setNewFileTargetDir(newFileTargetDir);
@@ -264,8 +432,9 @@ public class TorqueGfMojo extends Abstra
         UnitDescriptor unitDescriptor = new UnitDescriptor(
                 packaging,
                 projectPaths,
-                new DefaultTorqueGfPaths(),
+                new DefaultTorqueGeneratorPaths(),
                 null,
+                sourceFileset,
                 optionConfiguration,
                 convertedLoglevel);
         getLog().debug("unit descriptor created");
@@ -277,8 +446,9 @@ public class TorqueGfMojo extends Abstra
             unitDescriptor = new UnitDescriptor(
                     Packaging.DIRECTORY,
                     childProjectPaths,
-                    new DefaultTorqueGfPaths(),
+                    new DefaultTorqueGeneratorPaths(),
                     unitDescriptor,
+                    sourceFileset,
                     optionConfiguration,
                     convertedLoglevel);
             getLog().debug("child unit descriptor created");
@@ -286,7 +456,7 @@ public class TorqueGfMojo extends Abstra
         unitDescriptors.add(unitDescriptor);
         try
         {
-            getLog().debug("about to run controller");
+            getLog().debug("Generation started");
             controller.run(unitDescriptors);
             getLog().info("Generation successful");
         }
@@ -296,26 +466,79 @@ public class TorqueGfMojo extends Abstra
             throw new MojoExecutionException(e.getMessage());
         }
 
-        if (compileNewFileTargetDir
-                && projectPaths.getNewFileTargetPath().exists())
+        File newFileTargetPath = projectPaths.getNewFileTargetPath();
+        if (newFileTargetPath.exists())
         {
-            getLog().debug("Adding newFileTargetDir "
-                    + projectPaths.getNewFileTargetPath()
-                    + " as CompileSourceRoot");
-
-            project.addCompileSourceRoot(
-                    projectPaths.getNewFileTargetPath().toString());
+            switch (newFileTargetDirUsageConverted) 
+            {
+            case COMPILE:
+                project.addCompileSourceRoot(newFileTargetPath.toString());
+                getLog().debug("Added " 
+                        + newFileTargetPath.toString()
+                        + " as compile source root");
+                break;
+            case TEST_COMPILE:
+                project.addTestCompileSourceRoot(newFileTargetPath.toString());
+                getLog().debug("Added " 
+                        + newFileTargetPath.toString()
+                        + " as test compile source root");
+                break;
+            case RESOURCE:
+                Resource resource = new Resource();
+                resource.setDirectory(newFileTargetPath.toString());
+                project.addResource(resource);
+                getLog().debug("Added " 
+                        + newFileTargetPath.toString()
+                        + " to the project resources");
+                break;
+            case TEST_RESOURCE:
+                resource = new Resource();
+                resource.setDirectory(newFileTargetPath.toString());
+                project.addTestResource(resource);
+                getLog().debug("Added " 
+                        + newFileTargetPath.toString()
+                        + " to the project test resources");
+                break;
+            case NONE:
+            }
         }
 
-        if (compileModifiedFileTargetDir
-                && projectPaths.getModifiedFileTargetPath().exists())
+        File modifiedFileTargetPath = projectPaths.getModifiedFileTargetPath();
+        if (modifiedFileTargetPath.exists())
         {
-            getLog().debug("Adding modifiedFileTargetDir "
-                    + projectPaths.getModifiedFileTargetPath()
-                    + " as CompileSourceRoot");
-
-            project.addCompileSourceRoot(
-                    projectPaths.getModifiedFileTargetPath().toString());
+            switch (modifiedFileTargetDirUsageConverted) 
+            {
+            case COMPILE:
+                project.addCompileSourceRoot(modifiedFileTargetPath.toString());
+                getLog().debug("Added " 
+                        + modifiedFileTargetPath.toString()
+                        + " as compile source root");
+                break;
+            case TEST_COMPILE:
+                project.addTestCompileSourceRoot(
+                        modifiedFileTargetPath.toString());
+                getLog().debug("Added " 
+                        + modifiedFileTargetPath.toString()
+                        + " as test compile source root");
+                break;
+            case RESOURCE:
+                Resource resource = new Resource();
+                resource.setDirectory(modifiedFileTargetPath.toString());
+                project.addResource(resource);
+                getLog().debug("Added " 
+                        + modifiedFileTargetPath.toString()
+                        + " to the project resources");
+                break;
+            case TEST_RESOURCE:
+                resource = new Resource();
+                resource.setDirectory(modifiedFileTargetPath.toString());
+                project.addTestResource(resource);
+                getLog().debug("Added " 
+                        + modifiedFileTargetPath.toString()
+                        + " to the project test resources");
+                break;
+            case NONE:
+            }
         }
     }
 
@@ -389,4 +612,103 @@ public class TorqueGfMojo extends Abstra
     {
         this.project = project;
     }
+
+    /**
+     * Sets the usage for the newFileTargetDir.
+     * 
+     * @param newFileTargetDirUsage the new usage, not null.
+     */
+    public void setNewFileTargetDirUsage(String newFileTargetDirUsage)
+    {
+        if (newFileTargetDirUsage == null)
+        {
+            throw new NullPointerException(
+                    "newFileTargetDirUsage must not be null");
+        }
+        this.newFileTargetDirUsage = newFileTargetDirUsage;
+    }
+
+    /**
+     * Sets the usage for the modifiedFileTargetDir.
+     * 
+     * @param modifiedFileTargetDirUsage the new usage, not null.
+     */
+    public void setModifiedFileTargetDirUsage(String modifiedFileTargetDirUsage)
+    {
+        if (modifiedFileTargetDirUsage == null)
+        {
+            throw new NullPointerException(
+                    "modifiedFileTargetDirUsage must not be null");
+        }
+        this.modifiedFileTargetDirUsage = modifiedFileTargetDirUsage;
+    }
+
+    /**
+     * Sets the directory in which the source files are located.
+     * 
+     * @param sourceDir the directory in which the source files are located.
+     */
+    public void setSourceDir(File sourceDir)
+    {
+        this.sourceDir = sourceDir;
+    }
+
+    /**
+     * Sets the pattern which files are included in the generation process.
+     *
+     * @param sourceIncludes a list containing the include patterns, or null
+     *        if no include pattern should be used.
+     */
+    public void setSourceIncludes(Set<String> sourceIncludes)
+    {
+        this.sourceIncludes = sourceIncludes;
+    }
+
+    /**
+     * Sets the pattern which files are excluded in the generation process.
+     *
+     * @param sourceExcludes a list containing the exclude patterns, or null
+     *        if no exclude pattern should be used.
+     */
+    public void setSourceExcludes(Set<String> sourceExcludes)
+    {
+        this.sourceExcludes = sourceExcludes;
+    }
+
+    /**
+     * Sets the config directory overriding the template settings.
+     * If set, the settings of this directory are used as "child"
+     * and the "normal" settings are used as "parent".
+     *
+     * @parameter the config directory overriding the template settings,
+     *            or null if the template settings will not be overridden.
+     */
+    public void setOverrideConfigDir(File overrideConfigDir)
+    {
+        this.overrideConfigDir = overrideConfigDir;
+    }
+
+    /**
+     * Sets the Loglevel to use in the generation process. 
+     * 
+     * @param loglevel the loglevel, must be one of trace, debug, info, warn
+     *        or error, or null if the loglevel defined in the templates
+     *        should be used.
+     */
+    public void setLoglevel(String loglevel)
+    {
+        this.loglevel = loglevel;
+    }
+
+    /**
+     * Sets additional options which can be added to the generation process.
+     * These options overrides existing options in the templates.
+     * 
+     * @param options the overriding options, or null if no options
+     *        should be overridden.
+     */
+    public void setOptions(Map<String, String> options)
+    {
+        this.options = options;
+    }
 }

Copied: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/conf/control.xml
(from r916203, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/conf/control.xml?p2=db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/conf/control.xml&p1=db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml&r1=916203&r2=944880&rev=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/conf/control.xml
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/conf/control.xml
Sun May 16 16:28:18 2010
@@ -17,17 +17,16 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<control
+<control loglevel="debug"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://db.apache.org/torque/gf/4.0/configuration http://db.apache.org/torque/gf/4.0/configuration.xsd"
-    xmlns="http://db.apache.org/torque/gf/4.0/configuration"
-    loglevel="debug">
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns="http://db.apache.org/torque/4.0/generator/configuration">
   <output name="propertyKeys" 
-      file="org/apache/torque/gf/example/gettingstarted/PropertyKeys.java">
+      file="org/apache/torque/generator/maven/PropertyKeys.java">
     <source>
       <include>propertiesData.properties</include>
     </source>
-    <generator name="classFrame"/>
+    <outlet name="classFrame"/>
   </output>
 </control>
   
\ No newline at end of file

Copied: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/enumOutlets.xml
(from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/generatorDefs/enumGenerators.xml)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/enumOutlets.xml?p2=db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/enumOutlets.xml&p1=db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/generatorDefs/enumGenerators.xml&r1=910632&r2=944880&rev=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gf/generatorDefs/enumGenerators.xml
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/outlets/enumOutlets.xml
Sun May 16 16:28:18 2010
@@ -17,37 +17,40 @@
  specific language governing permissions and limitations
  under the License.
 -->
-<generators xmlns="http://db.apache.org/torque/gf/4.0/configuration"
-    xsi:schemaLocation="http://db.apache.org/torque/gf/4.0/configuration http://db.apache.org/torque/gf/4.0/generator.xsd"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <generator name="classFrame" xsi:type="velocityGenerator" path="classFrame.vm">
+<outlets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns="http://db.apache.org/torque/4.0/generator/configuration">
+  <outlet name="classFrame" xsi:type="velocityOutlet" path="classFrame.vm">
     <mergepoint name="constants">
-      <action xsi:type="traverseAllAction" element="entry" generator="constant"/>
+      <action xsi:type="traverseAllAction" element="entry" outlet="constant"/>
     </mergepoint>
     <mergepoint name="fields">
-      <action xsi:type="applyAction" generator="keyField"/>
-      <action xsi:type="applyAction" generator="newline"/>
+      <action xsi:type="applyAction" outlet="keyField"/>
+      <action xsi:type="applyAction" outlet="newline"/>
     </mergepoint>
     <mergepoint name="methods">
-      <action xsi:type="applyAction" generator="constructor"/>
-      <action xsi:type="applyAction" generator="newline"/>
-      <action xsi:type="applyAction" generator="getKey"/>
-      <action xsi:type="applyAction" generator="newline"/>
-      <action xsi:type="applyAction" generator="toString"/>
+      <action xsi:type="applyAction" outlet="constructor"/>
+      <action xsi:type="applyAction" outlet="newline"/>
+      <action xsi:type="applyAction" outlet="getKey"/>
+      <action xsi:type="applyAction" outlet="newline"/>
+      <action xsi:type="applyAction" outlet="toString"/>
     </mergepoint>
-  </generator>
-  <generator name="constant" xsi:type="velocityGenerator" path="constant.vm">
+  </outlet>
+
+  <outlet name="constant" xsi:type="velocityOutlet" path="constant.vm">
     <mergepoint name="constantName">
-      <action xsi:type="applyAction" generator="constantName"/>
+      <action xsi:type="applyAction" outlet="constantName"/>
     </mergepoint>
-  </generator>
-  <generator name="constantName" xsi:type="javaGenerator" class="org.apache.torque.gf.generator.java.ConstantNameGenerator">
+  </outlet>
+
+  <outlet name="constantName" xsi:type="javaOutlet" class="org.apache.torque.generator.outlet.java.ConstantNameOutlet">
     <inputSourceElement>.</inputSourceElement>
     <sourceElementAttribute>key</sourceElementAttribute>
-  </generator>
-  <generator name="keyField" xsi:type="velocityGenerator" path="keyField.vm"/>
-  <generator name="constructor" xsi:type="velocityGenerator" path="constructor.vm"/>
-  <generator name="getKey" xsi:type="velocityGenerator" path="getKey.vm"/>
-  <generator name="toString" xsi:type="velocityGenerator" path="toString.vm"/>
-  <generator name="newline" xsi:type="javaGenerator" class="org.apache.torque.gf.generator.java.NewlineGenerator"/>
-</generators>
\ No newline at end of file
+  </outlet>
+
+  <outlet name="keyField" xsi:type="velocityOutlet" path="keyField.vm"/>
+  <outlet name="constructor" xsi:type="velocityOutlet" path="constructor.vm"/>
+  <outlet name="getKey" xsi:type="velocityOutlet" path="getKey.vm"/>
+  <outlet name="toString" xsi:type="velocityOutlet" path="toString.vm"/>
+  <outlet name="newline" xsi:type="javaOutlet" class="org.apache.torque.generator.outlet.java.NewlineOutlet"/>
+</outlets>
\ No newline at end of file

Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/classFrame.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/classFrame.vm?rev=944880&r1=910632&r2=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/classFrame.vm
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/classFrame.vm
Sun May 16 16:28:18 2010
@@ -15,7 +15,7 @@
 ## specific language governing permissions and limitations
 ## under the License.
 ##
-package org.apache.torque.gf.example.gettingstarted;
+package org.apache.torque.generator.maven;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -41,7 +41,7 @@ package org.apache.torque.gf.example.get
  */
 public enum PropertyKeys 
 {
-$torqueGf.mergepoint("constants")##
-$torqueGf.mergepoint("fields")##
-$torqueGf.mergepoint("methods")##
+$torqueGen.mergepoint("constants")##
+$torqueGen.mergepoint("fields")##
+$torqueGen.mergepoint("methods")##
 }

Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/constant.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/constant.vm?rev=944880&r1=910632&r2=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/constant.vm
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/gettingStarted/src/main/torque-gen/templates/constant.vm
Sun May 16 16:28:18 2010
@@ -16,6 +16,6 @@
 ## under the License.
 ##
     /** Key for ${key} */
-    $torqueGf.mergepoint("constantName")("${key}")#if(${torqueGf.getSourceElement().hasFollowingSibling()}),#else;#end
+    $torqueGen.mergepoint("constantName")("${key}")#if(${torqueGen.getSourceElement().hasFollowingSibling()}),#else;#end
 
 

Copied: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java
(from r910632, db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/gf/maven/GettingStartedTest.java)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java?p2=db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java&p1=db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/gf/maven/GettingStartedTest.java&r1=910632&r2=944880&rev=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/gf/maven/GettingStartedTest.java
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java
Sun May 16 16:28:18 2010
@@ -1,4 +1,4 @@
-package org.apache.torque.gf.maven;
+package org.apache.torque.generator.maven;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -25,27 +25,30 @@ import junit.framework.TestCase;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.project.MavenProject;
+import org.apache.torque.generator.maven.TorqueGeneratorMojo;
 
-public class GettingStartedTest extends TestCase
+public class TorqueGeneratorMojoTest extends TestCase
 {
     public void testRun() throws Exception
     {
         File target = new File("target/tests/gettingStarted");
         FileUtils.deleteDirectory(target);
-        TorqueGfMojo mojo = new TorqueGfMojo();
+        TorqueGeneratorMojo mojo = new TorqueGeneratorMojo();
         mojo.setPackaging("directory");
         mojo.setProjectRootDir(new File("src/test/gettingStarted"));
         mojo.setNewFileTargetDir(target);
+        mojo.setNewFileTargetDirUsage("compile");
+        mojo.setModifiedFileTargetDirUsage("compile");
         mojo.setProject(new MavenProject());
         mojo.execute();
 
         assertTrue(target.exists());
         File generatedJavaFile = new File(
                 target,
-                "org/apache/torque/gf/example/gettingstarted/PropertyKeys.java");
+                "org/apache/torque/generator/maven/PropertyKeys.java");
         assertTrue(generatedJavaFile.exists());
         File expectedJavaFile = new File(
-                "src/test/resources/org/apache/torque/gf/example/gettingstarted/PropertyKeys.java");
+                "src/test/resources/org/apache/torque/generator/maven/PropertyKeys.java");
         junitx.framework.FileAssert.assertEquals(
                 expectedJavaFile,
                 generatedJavaFile);

Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/maven/PropertyKeys.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/maven/PropertyKeys.java?rev=944880&r1=910632&r2=944880&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/maven/PropertyKeys.java
(original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/resources/org/apache/torque/generator/maven/PropertyKeys.java
Sun May 16 16:28:18 2010
@@ -1,4 +1,4 @@
-package org.apache.torque.gf.example.gettingstarted;
+package org.apache.torque.generator.maven;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message