db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1188480 [1/3] - in /db/torque/torque4/trunk: maven-torque-generator-plugin/ maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/ maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/ torqu...
Date Tue, 25 Oct 2011 01:23:06 GMT
Author: tfischer
Date: Tue Oct 25 01:23:02 2011
New Revision: 1188480

URL: http://svn.apache.org/viewvc?rev=1188480&view=rev
Log:
TORQUE-169: Add append and merge modes to the generator

Added:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/AppendToTargetFileStrategy.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ExistingTargetStrategy.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/MergeTargetFileStrategy.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ReplaceTargetFileStrategy.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/SkipExistingTargetFileStrategy.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/outlets/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/outlets/output.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertiesCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertyCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/outlets/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/outlets/output.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertiesCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertyCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/outlets/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/outlets/output.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/source1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/source2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/templates/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/templates/propertiesCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/templates/propertyCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/package.html
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/conf/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/outlets/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/outlets/output.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/src/source1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/src/source2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/templates/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/templates/propertiesCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/templates/propertyCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/conf/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/outlets/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/outlets/output.xml
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/src/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/src/source1.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/src/source2.properties
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/templates/
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/templates/propertiesCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/templates/propertyCopy.vm
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/control/ExistingTargetStrategyTest.java
Modified:
    db/torque/torque4/trunk/maven-torque-generator-plugin/   (props changed)
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java
    db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java
    db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java
    db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java
    db/torque/torque4/trunk/torque-generator/pom.xml
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfiguration.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfigurationReader.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/Output.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputConfigurationTags.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/Maven2ProjectPaths.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/ProjectPaths.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
    db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.xsd
    db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/outlet.xsd
    db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen-parent/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ClasspathConfigurationProviderTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ReadConfigurationTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/outlet/OtherTemplateLanguageTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/control/DeeplyNestedMergepointsTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/control/PropertyToJavaGenerationTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/example/gettingstarted/GettingStartedTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/LoadAdditionalSourceTransformerTest.java
    db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/generator/reference/configuration.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java
    db/torque/torque4/trunk/torque-test/pom.xml

Propchange: db/torque/torque4/trunk/maven-torque-generator-plugin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Oct 25 01:23:02 2011
@@ -2,3 +2,4 @@
 target
 .settings
 .classpath
+.checkstyle

Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.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?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java (original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/main/java/org/apache/torque/generator/maven/TorqueGeneratorMojo.java Tue Oct 25 01:23:02 2011
@@ -45,6 +45,7 @@ import org.apache.torque.generator.confi
 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.Maven2ProjectPaths;
 import org.apache.torque.generator.configuration.paths.ProjectPaths;
 import org.apache.torque.generator.control.Controller;
 import org.apache.torque.generator.file.Fileset;
@@ -59,24 +60,25 @@ import org.apache.torque.generator.sourc
  */
 public class TorqueGeneratorMojo extends AbstractMojo implements Mojo
 {
-    private enum TargetDirUsage
+    /** Possible usages for generator output directories. */
+    private enum OutputDirUsage
     {
         /**
-         * The target dir will be added to the maven project's
+         * The output dir will be added to the maven project's
          * compileSourceRoot.
          */
         COMPILE("compile"),
         /**
-         * The target dir will be added to the maven project's
+         * The output 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.
+         * The output 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.
+         * The output dir will be added to the maven project's test resources.
          */
         TEST_RESOURCE("test-resource"),
         /**
@@ -84,6 +86,7 @@ public class TorqueGeneratorMojo extends
          */
         NONE("none");
 
+        /** The usage key. */
         private String key;
 
         /**
@@ -91,7 +94,7 @@ public class TorqueGeneratorMojo extends
          *
          * @param key the key for the enum.
          */
-        private TargetDirUsage(String key)
+        private OutputDirUsage(String key)
         {
             this.key = key;
         }
@@ -112,10 +115,10 @@ public class TorqueGeneratorMojo extends
             return key;
         }
 
-        public static TargetDirUsage get(String key)
+        public static OutputDirUsage get(String key)
             throws MojoExecutionException
         {
-            for (TargetDirUsage candidate : values())
+            for (OutputDirUsage candidate : values())
             {
                 if (candidate.getKey().equals(key))
                 {
@@ -126,7 +129,7 @@ public class TorqueGeneratorMojo extends
                 .append("targetDirUsage contains illegal value: ")
                 .append(key)
                 .append(". Possible values are :");
-            for (TargetDirUsage targetDirUsage: values())
+            for (OutputDirUsage targetDirUsage : values())
             {
                 errorMessage.append(" ").append(targetDirUsage.getKey());
             }
@@ -198,18 +201,34 @@ public class TorqueGeneratorMojo extends
     private Set<String> sourceExcludes;
 
     /**
-     * The target directory for files which are generated each time anew.
+     * The default base output directory for the generated files.
+     * Whether the configured templates use this directory or not,
+     * is up to the templates; check the template documentation.
      *
      * @parameter expression="${project.build.directory}/generated-sources"
+     * @required
+     */
+    private File defaultOutputDir;
+
+    /**
+     * The target directories for the generated files, keyed by the
+     * output directory keys.
+     * If output directory keys are used by the output
+     * (and if yes, which output directory keys),
+     * is up to the templates; check the template documentation.
+     * Default is to map the key "modifiable" to
+     * ${project.build.directory}/src/main/generated-java
+     *
+     * @parameter
      */
-    private File newFileTargetDir;
+    private Map<String, File> outputDirMap = new HashMap<String, File>();
 
     /**
-     * The target directory for files which are not generated each time anew.
+     * The work directory for e.g. merge sources.
      *
-     * @parameter expression="${basedir}/src/main/generated-java"
+     * @parameter expression="${basedir}/src/main/torque-gen/work"
      */
-    private File modifiedFileTargetDir;
+    private File workDir;
 
     /**
      * The filename of the jar file of the generation unit.
@@ -220,7 +239,7 @@ public class TorqueGeneratorMojo extends
     private String jarFile;
 
     /**
-     * What to do with the generated files in newFileTargetDir.
+     * What to do with the generated files in the default output directory.
      * Possible values are:
      * <ul>
      *   <li>
@@ -251,10 +270,11 @@ public class TorqueGeneratorMojo extends
      * @parameter expression="compile"
      * @required
      */
-    private String newFileTargetDirUsage;
+    private String defaultOutputDirUsage;
 
     /**
-     * What to do with the generated files in modifiedFileTargetDir.
+     * What to do with the generated files for the output directories
+     * defined in outputDirMap. The map uses the same keys as outputDirMap.
      * Possible values are:
      * <ul>
      *   <li>
@@ -281,11 +301,12 @@ public class TorqueGeneratorMojo extends
      *   <li>
      *     none: The generated files are not used in the maven build.
      *   </li>
+     * Default is to map the key "modifiable" to compile
      *
-     * @parameter expression="compile"
-     * @required
+     * @parameter
      */
-    private String modifiedFileTargetDirUsage;
+    private Map<String, String> outputDirUsageMap
+            = new HashMap<String, String>();
 
     /**
      * The config directory of the project overriding the settings.
@@ -312,7 +333,7 @@ public class TorqueGeneratorMojo extends
      * @parameter
      */
     private Map<String, String> options;
-    
+
     /**
      * Properties file which contains the options which can be added
      * to the generation process.
@@ -332,16 +353,26 @@ public class TorqueGeneratorMojo extends
      */
     private MavenProject project;
 
+    /**
+     * Configures and runs the Torque generator.
+     */
     public void execute() throws MojoExecutionException
     {
         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);
+        OutputDirUsage defaultOutputDirUsageConverted
+                = OutputDirUsage.get(defaultOutputDirUsage);
+        Map<String, OutputDirUsage> outputDirUsageConvertedMap
+                = new HashMap<String, OutputDirUsage>();
+        for (Map.Entry<String, String> outputDirUsageEntry
+                : outputDirUsageMap.entrySet())
+        {
+            outputDirUsageConvertedMap.put(
+                    outputDirUsageEntry.getKey(),
+                    OutputDirUsage.get(outputDirUsageEntry.getValue()));
+        }
 
         UnitDescriptor.Packaging packaging;
         if ("jar".equals(this.packaging))
@@ -437,17 +468,37 @@ public class TorqueGeneratorMojo extends
             }
         }
 
-        if (newFileTargetDir != null)
+        projectPaths.setOutputDirectory(null, defaultOutputDir);
+        getLog().debug("Setting defaultOutputDir to "
+                + defaultOutputDir.toString());
+        if (outputDirMap != null)
         {
-            projectPaths.setNewFileTargetDir(newFileTargetDir);
-            getLog().debug("Setting newFileTargetDir to "
-                    + newFileTargetDir.toString());
+            if (outputDirMap.get(Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
+                    == null)
+            {
+                outputDirMap.put(
+                        Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY,
+                        new File(project.getBuild().getDirectory()
+                                + "/"
+                                + Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR));
+            }
+            for (Map.Entry<String, File> outputDirMapEntry
+                    : outputDirMap.entrySet())
+            {
+                projectPaths.setOutputDirectory(
+                        outputDirMapEntry.getKey(),
+                        outputDirMapEntry.getValue());
+                getLog().debug("Setting output directory with key "
+                        + outputDirMapEntry.getKey()
+                        + " to "
+                        + outputDirMapEntry.getValue());
+            }
         }
-        if (modifiedFileTargetDir != null)
+        if (workDir != null)
         {
-            projectPaths.setModifiedFileTargetDir(modifiedFileTargetDir);
-            getLog().debug("Setting modifiedFileTargetDir to "
-                    + modifiedFileTargetDir.toString());
+            projectPaths.setWorkDir(workDir);
+            getLog().debug("Setting workDir to "
+                    + workDir.toString());
         }
         getLog().debug("ProjectPaths = " + projectPaths);
 
@@ -475,10 +526,10 @@ public class TorqueGeneratorMojo extends
                     getLog().error(e);
                     throw new MojoExecutionException(e.getMessage());
                 }
-                getLog().debug("loaded options file from " 
+                getLog().debug("loaded options file from "
                         + optionsFile.getAbsolutePath() + ", contents: "
                         + optionProperties);
-                for (Map.Entry<Object, Object> propertiesEntry 
+                for (Map.Entry<Object, Object> propertiesEntry
                         : optionProperties.entrySet())
                 {
                     if (!options.containsKey(propertiesEntry.getKey()))
@@ -535,78 +586,129 @@ public class TorqueGeneratorMojo extends
             throw new MojoExecutionException(e.getMessage());
         }
 
-        File newFileTargetPath = projectPaths.getNewFileTargetPath();
-        if (newFileTargetPath.exists())
+        File defaultOutputDirPath = projectPaths.getOutputDirectory(null);
+        if (defaultOutputDirPath.exists())
         {
-            switch (newFileTargetDirUsageConverted)
+            switch (defaultOutputDirUsageConverted)
             {
             case COMPILE:
-                project.addCompileSourceRoot(newFileTargetPath.toString());
+                project.addCompileSourceRoot(
+                        defaultOutputDirPath.toString());
                 getLog().debug("Added "
-                        + newFileTargetPath.toString()
+                        + defaultOutputDirPath.toString()
                         + " as compile source root");
                 break;
             case TEST_COMPILE:
-                project.addTestCompileSourceRoot(newFileTargetPath.toString());
+                project.addTestCompileSourceRoot(
+                        defaultOutputDirPath.toString());
                 getLog().debug("Added "
-                        + newFileTargetPath.toString()
+                        + defaultOutputDirPath.toString()
                         + " as test compile source root");
                 break;
             case RESOURCE:
                 Resource resource = new Resource();
-                resource.setDirectory(newFileTargetPath.toString());
+                resource.setDirectory(defaultOutputDirPath.toString());
                 project.addResource(resource);
                 getLog().debug("Added "
-                        + newFileTargetPath.toString()
+                        + defaultOutputDirPath.toString()
                         + " to the project resources");
                 break;
             case TEST_RESOURCE:
                 resource = new Resource();
-                resource.setDirectory(newFileTargetPath.toString());
+                resource.setDirectory(defaultOutputDirPath.toString());
                 project.addTestResource(resource);
                 getLog().debug("Added "
-                        + newFileTargetPath.toString()
+                        + defaultOutputDirPath.toString()
                         + " to the project test resources");
                 break;
             case NONE:
+            default:
             }
         }
+        else
+        {
+            getLog().info("defaultOutputDirPath "
+                + defaultOutputDirPath.getAbsolutePath()
+                + " does not exist, not applying defaultOutputDirUsage");
+        }
 
-        File modifiedFileTargetPath = projectPaths.getModifiedFileTargetPath();
-        if (modifiedFileTargetPath.exists())
+        if (outputDirUsageMap == null)
+        {
+            getLog().debug("no output directory usages other than the default "
+                    + "are defined");
+        }
+        else if (outputDirMap == null)
         {
-            switch (modifiedFileTargetDirUsageConverted)
+            getLog().debug("no output directories other than the default "
+                    + "are defined, ignoring outputDirUsageMap");
+        }
+        else
+        {
+            if (outputDirUsageConvertedMap.get(Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
+                    == null
+                && outputDirMap.get(Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY)
+                    != null)
             {
-            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:
+                outputDirUsageConvertedMap.put(
+                        Maven2ProjectPaths.MODIFIABLE_OUTPUT_DIR_KEY,
+                        OutputDirUsage.COMPILE);
+            }
+            for (Map.Entry<String, OutputDirUsage> usageEntry
+                    : outputDirUsageConvertedMap.entrySet())
+            {
+                File outputDirPath = outputDirMap.get(usageEntry.getKey());
+                if (outputDirPath == null)
+                {
+                    getLog().info("outputDirPath set for key "
+                            + usageEntry.getKey()
+                            + " ignoring this outputDirUsageMap entry");
+                }
+                else if (!outputDirPath.exists())
+                {
+                    getLog().info("outputDirPath "
+                            + outputDirPath.getAbsolutePath()
+                            + " for outputDirUsageMap with key "
+                            + usageEntry.getKey()
+                            + " does not exist,"
+                            + " ignoring this outputDirUsageMap entry");
+                }
+                else
+                {
+                    switch (usageEntry.getValue())
+                    {
+                    case COMPILE:
+                        project.addCompileSourceRoot(outputDirPath.toString());
+                        getLog().debug("Added "
+                                + outputDirPath.toString()
+                                + " as compile source root");
+                        break;
+                    case TEST_COMPILE:
+                        project.addTestCompileSourceRoot(
+                                outputDirPath.toString());
+                        getLog().debug("Added "
+                                + outputDirPath.toString()
+                                + " as test compile source root");
+                        break;
+                    case RESOURCE:
+                        Resource resource = new Resource();
+                        resource.setDirectory(outputDirPath.toString());
+                        project.addResource(resource);
+                        getLog().debug("Added "
+                                + outputDirPath.toString()
+                                + " to the project resources");
+                        break;
+                    case TEST_RESOURCE:
+                        resource = new Resource();
+                        resource.setDirectory(outputDirPath.toString());
+                        project.addTestResource(resource);
+                        getLog().debug("Added "
+                                + outputDirPath.toString()
+                                + " to the project test resources");
+                        break;
+                    case NONE:
+                    default:
+                    }
+                }
             }
         }
     }
@@ -642,13 +744,13 @@ public class TorqueGeneratorMojo extends
     }
 
     /**
-     * Sets the target directory for files which are generated each time anew.
+     * Sets the default output directory for generated files.
      *
-     * @param targetDir the target directory, or null to use the default.
+     * @param outputDir the default output directory, not null.
      */
-    public void setNewFileTargetDir(File targetDir)
+    public void setDefaultOutputDir(File outputDir)
     {
-        this.newFileTargetDir = targetDir;
+        this.defaultOutputDir = outputDir;
     }
 
     /**
@@ -657,9 +759,9 @@ public class TorqueGeneratorMojo extends
      *
      * @param targetDir the target directory, or null to use the default.
      */
-    public void setModifiedFileTargetDir(File targetDir)
+    public void setOutputDir(String outputDirKey, File outputDir)
     {
-        this.modifiedFileTargetDir = targetDir;
+        this.outputDirMap.put(outputDirKey, outputDir);
     }
 
     /**
@@ -683,33 +785,41 @@ public class TorqueGeneratorMojo extends
     }
 
     /**
-     * Sets the usage for the newFileTargetDir.
+     * Sets the usage for the default output dir.
      *
-     * @param newFileTargetDirUsage the new usage, not null.
+     * @param defaultOutputDirUsage the new usage, not null.
      */
-    public void setNewFileTargetDirUsage(String newFileTargetDirUsage)
+    public void setDefaultOutputDirUsage(String defaultOutputDirUsage)
     {
-        if (newFileTargetDirUsage == null)
+        if (defaultOutputDirUsage == null)
         {
             throw new NullPointerException(
-                    "newFileTargetDirUsage must not be null");
+                    "defaultOutputDirUsage must not be null");
         }
-        this.newFileTargetDirUsage = newFileTargetDirUsage;
+        this.defaultOutputDirUsage = defaultOutputDirUsage;
     }
 
     /**
-     * Sets the usage for the modifiedFileTargetDir.
+     * Sets the usage for an output directory.
      *
-     * @param modifiedFileTargetDirUsage the new usage, not null.
+     * @param outputDirKey key for the output directory, not null.
+     * @param outputDirUsage the new usage, not null.
      */
-    public void setModifiedFileTargetDirUsage(String modifiedFileTargetDirUsage)
+    public void setOutputDirUsage(
+            String outputDirKey,
+            String outputDirUsage)
     {
-        if (modifiedFileTargetDirUsage == null)
+        if (outputDirKey == null)
+        {
+            throw new NullPointerException(
+                    "outputDirKey must not be null");
+        }
+        if (outputDirUsage == null)
         {
             throw new NullPointerException(
                     "modifiedFileTargetDirUsage must not be null");
         }
-        this.modifiedFileTargetDirUsage = modifiedFileTargetDirUsage;
+        this.outputDirUsageMap.put(outputDirKey, outputDirUsage);
     }
 
     /**

Modified: db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.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?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java (original)
+++ db/torque/torque4/trunk/maven-torque-generator-plugin/src/test/java/org/apache/torque/generator/maven/TorqueGeneratorMojoTest.java Tue Oct 25 01:23:02 2011
@@ -36,9 +36,8 @@ public class TorqueGeneratorMojoTest ext
         TorqueGeneratorMojo mojo = new TorqueGeneratorMojo();
         mojo.setPackaging("directory");
         mojo.setProjectRootDir(new File("src/test/gettingStarted"));
-        mojo.setNewFileTargetDir(target);
-        mojo.setNewFileTargetDirUsage("compile");
-        mojo.setModifiedFileTargetDirUsage("compile");
+        mojo.setDefaultOutputDir(target);
+        mojo.setDefaultOutputDirUsage("compile");
         mojo.setProject(new MavenProject());
         mojo.execute();
 

Modified: db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java (original)
+++ db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/TorqueGeneratorTask.java Tue Oct 25 01:23:02 2011
@@ -105,13 +105,13 @@ public class TorqueGeneratorTask extends
      * The target directory for files which are generated each time anew.
      * Default is "./generated-sources"
      */
-    private File newFileTargetDir = new File("target/generated-sources");
+    private File defaultOutputDir = new File("target/generated-sources");
 
     /**
      * The target directory for files which are not generated each time anew.
-     * Default is "./src/main/generated-java"
+     * Default is modifiable -> "./src/main/generated-java"
      */
-    private File modifiedFileTargetDir = new File("src/main/generated-java");
+    private Map<String, File> outputDirMap = new HashMap<String, File>();
 
     /**
      * The filename of the jar file of the generation unit.
@@ -252,18 +252,25 @@ public class TorqueGeneratorTask extends
             }
         }
 
-        if (newFileTargetDir != null)
+        if (defaultOutputDir != null)
         {
-            projectPaths.setNewFileTargetDir(newFileTargetDir);
-            log("Setting newFileTargetDir to " + newFileTargetDir.toString(),
-                    Project.MSG_DEBUG);
+            projectPaths.setOutputDirectory(null, defaultOutputDir);
+            log("Setting defaultOutputDir to "
+                    + defaultOutputDir.getAbsolutePath(),
+                Project.MSG_DEBUG);
         }
-        if (modifiedFileTargetDir != null)
+        if (outputDirMap != null)
         {
-            projectPaths.setModifiedFileTargetDir(modifiedFileTargetDir);
-            log("Setting modifiedFileTargetDir to "
-                    + modifiedFileTargetDir.toString(),
-                Project.MSG_DEBUG);
+            for (Map.Entry<String, File> dirEntry : outputDirMap.entrySet())
+            {
+                projectPaths.setOutputDirectory(
+                        dirEntry.getKey(),
+                        dirEntry.getValue());
+                log("Setting output directory with key " + dirEntry.getKey()
+                        + " to "
+                        + dirEntry.getValue(),
+                    Project.MSG_DEBUG);
+            }
         }
         log("ProjectPaths = " + projectPaths, Project.MSG_DEBUG);
 
@@ -352,24 +359,25 @@ public class TorqueGeneratorTask extends
     }
 
     /**
-     * Sets the target directory for files which are generated each time anew.
+     * Sets the default output base directory for generated files.
      *
-     * @param targetDir the target directory, or null to use the default.
+     * @param targetDir the default output directory,
+     *                  or null to use the default.
      */
-    public void setNewFileTargetDir(File targetDir)
+    public void setDefaultOutputDir(File defaultOutputDir)
     {
-        this.newFileTargetDir = targetDir;
+        this.defaultOutputDir = defaultOutputDir;
     }
 
     /**
-     * Sets the target directory for files which are not generated
-     * each time anew.
+     * Sets the mapping from outputDirKey to output directories.
+     * The outputDirKeys are defined in the templates you use.
      *
-     * @param targetDir the target directory, or null to use the default.
+     * @param outputDirMap the new outputDirMap.
      */
-    public void setModifiedFileTargetDir(File targetDir)
+    public void setModifiedFileTargetDir(Map<String, File> outputDirMap)
     {
-        this.modifiedFileTargetDir = targetDir;
+        this.outputDirMap = outputDirMap;
     }
 
     /**

Modified: db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java (original)
+++ db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java Tue Oct 25 01:23:02 2011
@@ -34,7 +34,7 @@ public class TorqueGeneratorTaskTest ext
         TorqueGeneratorTask task = new TorqueGeneratorTask();
         task.setPackaging("directory");
         task.setProjectRootDir(new File("src/test/torqueGeneratorTaskTest"));
-        task.setNewFileTargetDir(target);
+        task.setDefaultOutputDir(target);
         task.execute();
 
         assertTrue(target.exists());

Modified: db/torque/torque4/trunk/torque-generator/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/pom.xml?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/pom.xml (original)
+++ db/torque/torque4/trunk/torque-generator/pom.xml Tue Oct 25 01:23:02 2011
@@ -41,6 +41,17 @@
       <version>1.7</version>
     </dependency>
     <dependency>
+      <groupId>com.madgag</groupId>
+      <artifactId>org.eclipse.jgit</artifactId>
+      <version>0.10.99.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>com.jcraft</groupId>
+          <artifactId>jsch</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
       <version>1.1.1</version>

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfiguration.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfiguration.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfiguration.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfiguration.java Tue Oct 25 01:23:02 2011
@@ -22,7 +22,9 @@ package org.apache.torque.generator.conf
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.torque.generator.configuration.controller.Loglevel;
 import org.apache.torque.generator.configuration.controller.Output;
@@ -32,7 +34,7 @@ import org.apache.torque.generator.optio
 import org.apache.torque.generator.source.SourceProvider;
 
 /**
- * A container for the configuration for a generation unit.
+ * Contains all information to run a generation unit.
  * Provides state checking, i.e. getters can only be called
  * after all setters has been called.
  */
@@ -60,16 +62,15 @@ public class UnitConfiguration
     private ConfigurationHandlers configurationHandlers;
 
     /**
-     * The root directory where the generated file which are generated
-     * each time anew are put into.
+     * The base output directories for the generated files,
+     * keyed by the output directory key.
      */
-    private File newFileTargetDirectory;
+    private Map<String, File> outputDirectoryMap = new HashMap<String, File>();
 
     /**
-     * The root directory where the generated file which are not generated
-     * each time anew are put into.
+     * A directory where the Torque generator can store internal files
      */
-    private File modifiedFileTargetDirectory;
+    private File workDirectory;
 
     /** The Loglevel for generation. */
     private Loglevel loglevel = Loglevel.INFO;
@@ -144,77 +145,108 @@ public class UnitConfiguration
     }
 
     /**
-     * Returns the target directory for the files which are generated
-     * each time anew of the associated configuration unit.
+     * Returns the output directory for a given output directory key.
      *
-     * @return the target directory for the files which are generated
-     *         each time anew, not null.
+     * @param outputDirKey the key which output directory should be returned.
+     *        Null represents the default output directory and is always
+     *        mapped to a non-null value.
      *
-     * @throws IllegalStateException if the target directory was not yet set.
+     * @return the output directory for the key, not null.
+     *
+     * @throws IllegalStateException if the default output directory
+     *         was not yet set.
      */
-    public File getNewFileTargetDirectory()
+    public File getOutputDirectory(String outputDirKey)
     {
-        if (newFileTargetDirectory == null)
+        File result = outputDirectoryMap.get(outputDirKey);
+        if (result == null)
         {
             throw new IllegalStateException(
-                    "newFileTargetDirectory is not initialized");
+                    "The output directory for the key " + outputDirKey 
+                    + "is not set");
         }
-        return newFileTargetDirectory;
+        return result;
     }
 
     /**
-     * Returns the target directory for the files which are not generated
-     * each time anew of the associated configuration unit.
+     * Returns the output directory map which contains the mapping
+     * from output directory key to output directory.
      *
-     * @return the target directory for the files which are generated
-     *         each time anew, not null.
+     * @return the immutable output directory map, not null, contains at least
+     *         a mapping for the key null.
      *
-     * @throws IllegalStateException if the target directory was not yet set.
+     * @throws IllegalStateException if no mapping is contained
+     *         for the key null.
      */
-    public File getModifiedFileTargetDirectory()
+    public Map<String, File> getOutputDirectoryMap()
     {
-        if (modifiedFileTargetDirectory == null)
+        if (outputDirectoryMap.get(null) == null)
         {
             throw new IllegalStateException(
-                    "modifiedFileTargetDirectory is not initialized");
+                    "outputDirectoryMap does not contain a mapping"
+                        + " for the key null");
         }
-        return modifiedFileTargetDirectory;
+        return Collections.unmodifiableMap(outputDirectoryMap);
     }
 
     /**
-     * Sets the target directory for the files which are generated
-     * each time anew of the associated configuration unit.
+     * Sets the output directory map which contains the mapping
+     * from output directory key to output directory.
      *
-     * @param newFileTargetDirectory the target directory, not null.
+     * @param outputDirectoryMap the new output directory map,
+     *        must contain at least a mapping for the key null.
      *
-     * @throws NullPointerException if targetDirectory is null.
+     * @throws NullPointerException if outputDirectoryMap is null.
+     * @throws IllegalStateException if the target directory was not yet set.
      */
-    public void setNewFileTargetDirectory(File newFileTargetDirectory)
+    public void setOutputDirectoryMap(Map<String, File> outputDirectoryMap)
     {
-        if (newFileTargetDirectory == null)
+        if (outputDirectoryMap == null)
         {
             throw new NullPointerException(
-                    "newFileTargetDirectory cannot be null");
+                    "outputDirectoryMap may not be null");
         }
-        this.newFileTargetDirectory = newFileTargetDirectory;
+        if (outputDirectoryMap.get(null) == null)
+        {
+            throw new IllegalArgumentException(
+                    "outputDirectoryMap(null) may not be null");
+        }
+        this.outputDirectoryMap.clear();
+        this.outputDirectoryMap.putAll(outputDirectoryMap);
     }
 
     /**
-     * Sets the target directory for the files which are not generated
-     * each time anew of the associated configuration unit.
+     * Returns the directory where the generator can store internal files.
      *
-     * @param modifiedFileTargetDirectory the target directory, not null.
+     * @return the directory where the generator can store internal files,
+     *         not null.
      *
-     * @throws NullPointerException if targetDirectory is null.
+     * @throws IllegalStateException if the target directory was not yet set.
      */
-    public void setModifiedFileTargetDirectory(File modifiedFileTargetDirectory)
+    public File getWorkDirectory()
     {
-        if (modifiedFileTargetDirectory == null)
+        if (workDirectory == null)
         {
-            throw new NullPointerException(
-                    "modifiedFileTargetDirectory cannot be null");
+            throw new IllegalStateException(
+                    "workDirectory is not initialized");
+        }
+        return workDirectory;
+    }
+
+    /**
+     * Sets the directory where the generator can store internal files.
+     *
+     * @param workDirectory the work directory, not null.
+     *
+     * @throws NullPointerException if workDirectory is null.
+     */
+    public void setWorkDirectory(File workDirectory)
+    {
+        if (workDirectory == null)
+        {
+            throw new NullPointerException("workDirectory cannot be null");
         }
-        this.modifiedFileTargetDirectory = modifiedFileTargetDirectory;
+        this.workDirectory = workDirectory;
     }
 
     /**
@@ -400,8 +432,7 @@ public class UnitConfiguration
         if (outputList == null
             || options == null
             || outletConfiguration == null
-            || newFileTargetDirectory == null
-            || modifiedFileTargetDirectory == null
+            || outputDirectoryMap.get(null) == null
             || loglevel == null
             || configurationHandlers == null
             || entityReferences == null
@@ -422,10 +453,8 @@ public class UnitConfiguration
                 .append(options)
                 .append(", outletConfiguration=")
                 .append(outletConfiguration)
-                .append(", newFileTargetDirectory=")
-                .append(newFileTargetDirectory)
-                .append(", modifiedFileTargetDirectory=")
-                .append(modifiedFileTargetDirectory)
+                .append(", outputDirectoryMap=")
+                .append(outputDirectoryMap)
                 .append(", loglevel=")
                 .append(loglevel)
                 .append(")");

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfigurationReader.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfigurationReader.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfigurationReader.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitConfigurationReader.java Tue Oct 25 01:23:02 2011
@@ -89,10 +89,10 @@ class UnitConfigurationReader
         UnitConfiguration unitConfiguration = new UnitConfiguration();
         unitConfiguration.setConfigurationHandlers(
                 configurationHandlers);
-        unitConfiguration.setNewFileTargetDirectory(
-                unitDescriptor.getProjectPaths().getNewFileTargetPath());
-        unitConfiguration.setModifiedFileTargetDirectory(
-                unitDescriptor.getProjectPaths().getModifiedFileTargetPath());
+        unitConfiguration.setOutputDirectoryMap(
+                unitDescriptor.getProjectPaths().getOutputDirectoryMap());
+        unitConfiguration.setWorkDirectory(
+                unitDescriptor.getProjectPaths().getWorkDirectory());
         unitConfiguration.setOverrideSourceProvider(
                 unitDescriptor.getOverrideSourceProvider());
 

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/Output.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/Output.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/Output.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/Output.java Tue Oct 25 01:23:02 2011
@@ -19,6 +19,7 @@ package org.apache.torque.generator.conf
  * under the License.
  */
 
+import org.apache.torque.generator.control.ReplaceTargetFileStrategy;
 import org.apache.torque.generator.outlet.Outlet;
 import org.apache.torque.generator.qname.QualifiedName;
 import org.apache.torque.generator.source.SourceProcessConfiguration;
@@ -64,9 +65,22 @@ public class Output
     private String filename;
 
     /**
-     * Whether generation should be skipped if the file already exists.
+     * The strategy how existing target files should be handled.
      */
-    private boolean skipIfExists;
+    private String existingTargetStrategy 
+            = ReplaceTargetFileStrategy.STRATEGY_NAME;
+
+    /**
+     * The key for the output directory into which the output is written,
+     * or null for the default output directory.
+     */
+    private String outputDirKey;
+
+    /** 
+     * The character encoding of the generated file, or null for the platform
+     * default encoding.
+     */
+    private String encoding = "ISO-8859-1";
 
     /**
      * Constructor.
@@ -204,37 +218,69 @@ public class Output
     }
 
     /**
-     * Returns whether the generation of this file should be skipped
-     * if the file already exists.
+     * Returns the strategy how existing target files should be handled.
      *
-     * @return true if generation should be skipped if the file already exists.
+     * @return the strategy name.
      */
-    public boolean isSkipIfExists()
+    public String getExistingTargetStrategy()
     {
-        return skipIfExists;
+        return existingTargetStrategy;
     }
 
     /**
-     * Sets whether the generation of this file should be skipped
-     * if the file already exists.
+     * Sets the strategy how existing target files should be handled.
      *
-     * @param skipIfExists true if generation should be skipped if the file
-     *        already exists, false otherwise.
+     * @param existingTargetStrategy the strategy name.
      */
-    public void setSkipIfExists(boolean skipIfExists)
+    public void setExistingTargetStrategy(String existingTargetStrategy)
     {
-        this.skipIfExists = skipIfExists;
+        this.existingTargetStrategy = existingTargetStrategy;
     }
 
     /**
-     * Returns whether the target file is always generated anew.
-     *
-     * @return true if the target file is always generated anew,
-     *         false otherwise.
+     * Returns the key for the output directory into which the output is
+     * written.
+     * 
+     * @return the key  for the output directory, or null for the default
+     *         output directory.
+     */
+    public String getOutputDirKey()
+    {
+        return outputDirKey;
+    }
+
+    /**
+     * Sets the key for the output directory into which the output is
+     * written.
+     * 
+     * @param outputKeyDir the key  for the output directory,
+     *        or null for the default output directory.
+     */
+    public void setOutputDirKey(String outputKeyDir)
+    {
+        this.outputDirKey = outputKeyDir;
+    }
+
+    /**
+     * Returns the character encoding of the generated file(s).
+     * 
+     * @return The character encoding of the generated file,
+     *         or null for the platform default encoding.
+     */
+    public String getEncoding()
+    {
+        return encoding;
+    }
+
+    /**
+     * Sets the character encoding of the generated file(s).
+     * 
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
      */
-    public boolean isAlwaysNew()
+    public void setEncoding(String encoding)
     {
-        return !skipIfExists;
+        this.encoding = encoding;
     }
 
     /**
@@ -245,7 +291,10 @@ public class Output
     {
         StringBuffer result = new StringBuffer();
         result.append("(OutputFile: sourceProvider=").append(sourceProvider)
-                .append(",skipIfExists=").append(skipIfExists)
+                .append(",existingTargetStrategy=")
+                .append(existingTargetStrategy)
+                .append(",encoding=")
+                .append(encoding)
                 .append(",filenameOutlet=")
                 .append(filenameOutlet)
                 .append(",contentOutlet=")

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputConfigurationTags.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputConfigurationTags.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputConfigurationTags.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputConfigurationTags.java Tue Oct 25 01:23:02 2011
@@ -37,12 +37,20 @@ public final class OutputConfigurationTa
     /** Attribute name for the "name" attribute. */
     public static final String NAME_ATTRIBUTE = "name";
 
-    /** Attribute name for the "skipIfExists" attribute. */
-    public static final String SKIP_IF_EXISTS_ATTRIBUTE = "skipIfExists";
+    /** Attribute name for the "existingTargetStrategy" attribute. */
+    public static final String EXISTING_TARGET_STRATEGY_ATTRIBUTE 
+            = "existingTargetStrategy";
+
+    /** Attribute name for the "existingTargetStrategy" attribute. */
+    public static final String OUTPUT_DIR_KEY_ATTRIBUTE 
+            = "outputDirKey";
 
     /** Attribute name for the "file" attribute. */
     public static final String FILE_ATTRIBUTE = "file";
 
+    /** Attribute name for the "encoding" attribute. */
+    public static final String ENCODING_ATTRIBUTE = "encoding";
+
     /** Tag name for the "outlet" tag. */
     public static final String OUTLET_TAG = "outlet";
 

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputSaxHandler.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputSaxHandler.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/OutputSaxHandler.java Tue Oct 25 01:23:02 2011
@@ -19,12 +19,14 @@ package org.apache.torque.generator.conf
  * under the License.
  */
 
+import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.ENCODING_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.EXISTING_TARGET_STRATEGY_ATTRIBUTE;
 import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.FILENAME_GENERATOR_TAG;
-import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.FILE_ATTRIBUTE;
 import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.NAME_ATTRIBUTE;
 import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.OUTLET_TAG;
 import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.OUTPUT_TAG;
-import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.SKIP_IF_EXISTS_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.FILE_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.controller.OutputConfigurationTags.OUTPUT_DIR_KEY_ATTRIBUTE;
 import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.INPUT_TAG;
 import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SOURCE_TAG;
 
@@ -180,11 +182,19 @@ public class OutputSaxHandler extends De
             {
                 output.setFilename(attributes.getValue(FILE_ATTRIBUTE));
             }
-            if (attributes.getValue(SKIP_IF_EXISTS_ATTRIBUTE) != null)
+            if (attributes.getValue(EXISTING_TARGET_STRATEGY_ATTRIBUTE) != null)
+            {
+                output.setExistingTargetStrategy(
+                        attributes.getValue(EXISTING_TARGET_STRATEGY_ATTRIBUTE));
+            }
+            if (attributes.getValue(OUTPUT_DIR_KEY_ATTRIBUTE) != null)
+            {
+                output.setOutputDirKey(
+                        attributes.getValue(OUTPUT_DIR_KEY_ATTRIBUTE));
+            }
+            if (attributes.getValue(ENCODING_ATTRIBUTE) != null)
             {
-                output.setSkipIfExists(
-                        Boolean.parseBoolean(
-                            attributes.getValue(SKIP_IF_EXISTS_ATTRIBUTE)));
+                output.setEncoding(attributes.getValue(ENCODING_ATTRIBUTE));
             }
         }
         else if (SOURCE_TAG.equals(rawName))

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/CustomProjectPaths.java Tue Oct 25 01:23:02 2011
@@ -20,6 +20,8 @@ package org.apache.torque.generator.conf
  */
 
 import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Implementation of ProjectPaths with custom paths.
@@ -42,14 +44,14 @@ public class CustomProjectPaths implemen
     private File sourceDir;
 
     /**
-     * The output directory for the files which are generated each time anew.
+     * The output directories for the files, keyed by the output directory key.
      */
-    private File newFileTargetDir;
+    private Map<String, File>  outputDirectoryMap = new HashMap<String, File>();
 
     /**
-     * The output directory for the files which are modified on generation.
+     * The directory where the torque generator can store internal files.
      */
-    private File modifiedFileTargetDir;
+    private File workDir;
 
     /**
      * Copy-constructor.
@@ -62,8 +64,9 @@ public class CustomProjectPaths implemen
         this.configurationDir = toCopy.getConfigurationPath();
         this.configurationPackage = toCopy.getConfigurationPackage();
         this.sourceDir = toCopy.getDefaultSourcePath();
-        this.newFileTargetDir = toCopy.getNewFileTargetPath();
-        this.modifiedFileTargetDir = toCopy.getModifiedFileTargetPath();
+        this.outputDirectoryMap = new HashMap<String, File>(
+                toCopy.getOutputDirectoryMap());
+        this.workDir = toCopy.getWorkDirectory();
     }
 
     /**
@@ -75,23 +78,24 @@ public class CustomProjectPaths implemen
      *        generator configuration files, or null if the configuration files
      *        are loaded from the file system.
      * @param sourceDir the default directory for the source files, or null.
-     * @param newFileTargetDir the default directory for the files
-     *        which are generated each time anew, or null for the default.
-     * @param modifiedFileTargetDir the default directory for the files
-     *        which are modified on generation., or null for the default.
+     * @param outputDirectoryMap The output directories for the files,
+     *        keyed by the output directory key. The directory with the key
+     *        null is the default output directory.
+     * @param workDir directory where the torque generator can store
+     *        internal files.
      */
     public CustomProjectPaths(
             File configurationDir,
             String configurationPackage,
             File sourceDir,
-            File newFileTargetDir,
-            File modifiedFileTargetDir)
+            Map<String, File> outputDirectoryMap,
+            File workDir)
     {
         this.configurationDir = configurationDir;
         this.configurationPackage = configurationPackage;
         this.sourceDir = sourceDir;
-        this.newFileTargetDir = newFileTargetDir;
-        this.modifiedFileTargetDir = modifiedFileTargetDir;
+        this.outputDirectoryMap = new HashMap<String, File>(outputDirectoryMap);
+        this.workDir = workDir;
     }
 
     /**
@@ -134,27 +138,41 @@ public class CustomProjectPaths implemen
     }
 
     /**
-     * Sets the default directory for the files which are generated each time
-     * anew, relative to the current directory, or absolute.
+     * Sets the output directory for a given output directory key.
      *
-     * @param targetDir the directory for the files which are generated
-     * each time anew, null to invalidate the current setting.
+     * @param outputDirKey the output directory key, or null for the default
+     *        output directory.
+     * @param outputDir the output directory for the key,
+     *        relative to the current directory, or absolute.
+     *        Use null to remove the output directory for the key.
      */
-    public void setNewFileTargetDir(File targetDir)
+    public void setOutputDirectory(String outputDirKey, File outputDir)
     {
-        this.newFileTargetDir = targetDir;
+        this.outputDirectoryMap.put(outputDirKey, outputDir);
     }
 
     /**
-     * Sets the default directory for the files which are modified on
-     * generation, relative to the current directory, or absolute.
+     * Sets the contents of the output directory map. The directory with the key
+     *        null is the default output directory.
      *
-     * @param targetDir the default directory for the generated files,
+     * @param outputDirectoryMap the new output directory map.
+     */
+    public void setOutputDirectoryMap(Map<String, File> outputDirectoryMap)
+    {
+        this.outputDirectoryMap.clear();
+        this.outputDirectoryMap.putAll(outputDirectoryMap);
+    }
+
+    /**
+     * Sets the directory where the torque generator can store internal files,
+     * relative to the current directory, or absolute.
+     *
+     * @param workDir the directory for internal files,
      *         null to invalidate the current setting.
      */
-    public void setModifiedFileTargetDir(File targetDir)
+    public void setWorkDir(File workDir)
     {
-        this.modifiedFileTargetDir = targetDir;
+        this.workDir = workDir;
     }
 
     /**
@@ -213,41 +231,71 @@ public class CustomProjectPaths implemen
     }
 
     /**
-     * Returns the default subdirectory for files which are generated each
-     * time anew, relative to the project root.
+     * Returns the output directory for a given output directory key.
+     *
+     * @param outputDirKey the output directory key, or null for the default
+     *        output directory.
+     *
+     * @return the output directory for the key,
+     *         relative to the current directory, or absolute, not null.
+     *
+     * @throws IllegalStateException if one of the required parameters
+     *         is not set.
+     * @throws IllegalArgumentException if the outputDirKey is unknown.
+     */
+    public File getOutputDirectory(String outputDirKey)
+    {
+        if (!isInit())
+        {
+            throw new IllegalStateException(
+                    "CustomProjectPaths is not initialized");
+        }
+        File result = outputDirectoryMap.get(outputDirKey);
+        if (result == null)
+        {
+            throw new IllegalArgumentException(
+                    "unknown outputDirKey " + outputDirKey);
+        }
+        return result;
+    }
+
+    /**
+     * Returns the output directory map which contains the mapping
+     * from output directory key to output directory.
+     *
+     * @return the mutable output directory map, not null, contains at least
+     *         a mapping for the key null.
      *
-     * @return the subdirectory for the files which are generated each
-     *         time anew, not null.
      * @throws IllegalStateException if one of the required parameters
      *         is not set.
      */
-    public File getNewFileTargetPath()
+    public Map<String, File> getOutputDirectoryMap()
     {
         if (!isInit())
         {
             throw new IllegalStateException(
                     "CustomProjectPaths is not initialized");
         }
-        return newFileTargetDir;
+        return outputDirectoryMap;
     }
 
     /**
-     * Returns the default subdirectory for files which are not generated each
-     * time anew, relative to the project root.
+     * Returns the directory where the torque generator can store
+     * internal files, relative to the project root.
      *
-     * @return the subdirectory for the files which are not generated each
-     *         time anew, not null.
+     * @return the directory where the torque generator can store
+     *         internal files, not null.
      * @throws IllegalStateException if one of the required parameters
      *         is not set.
      */
-    public File getModifiedFileTargetPath()
+    public File getWorkDirectory()
     {
         if (!isInit())
         {
             throw new IllegalStateException(
                     "CustomProjectPaths is not initialized");
         }
-        return modifiedFileTargetDir;
+        return workDir;
     }
 
     /**
@@ -261,8 +309,8 @@ public class CustomProjectPaths implemen
     {
         return (configurationDir != null || configurationPackage != null)
             && sourceDir != null
-            && newFileTargetDir != null
-            && modifiedFileTargetDir != null;
+            && outputDirectoryMap.get(null) != null
+            && workDir != null;
     }
 
     @Override
@@ -271,8 +319,8 @@ public class CustomProjectPaths implemen
         return "(CustomProjectPaths: configurationDir=" + configurationDir
             + ", configurationPackage=" + configurationPackage
             + ", sourceDir=" + sourceDir
-            + ", newFileTargetDir=" + newFileTargetDir
-            + ", modifiedFileTargetDir=" + modifiedFileTargetDir
+            + ", outputDirectoryMap=" + outputDirectoryMap
+            + ", workDir=" + workDir
             + ")";
     }
 }

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/Maven2ProjectPaths.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/Maven2ProjectPaths.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/Maven2ProjectPaths.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/Maven2ProjectPaths.java Tue Oct 25 01:23:02 2011
@@ -20,6 +20,9 @@ package org.apache.torque.generator.conf
  */
 
 import java.io.File;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -47,25 +50,44 @@ public abstract class Maven2ProjectPaths
     protected static final String SOURCE_DIR = CONFIG_DIR + "src";
 
     /**
-     * Default generation target directory for new files,
+     * Key for the target directory for generated files
+     * which are modifiable by the user, relative to the project root.
+     */
+    public static final String MODIFIABLE_OUTPUT_DIR_KEY
+            = "modifiable";
+
+    /**
+     * Default generation target directory for generated files
+     * which are modifiable by the user, relative to the project root.
+     */
+    public static final String MODIFIABLE_OUTPUT_DIR
+            = "src/main/generated-java";
+
+    /**
+     * Default generation target directory,
      * relative to the project root.
      */
-    protected static final String NEW_FILE_TARGET_DIR
+    protected static final String DEFAULT_OUTPUT_DIR
             = "target/generated-sources";
 
     /**
-     * Default generation target directory for modified files,
-     * relative to the project root.
+     * Default working directory.
      */
-    protected static final String MODIFIED_FILE_TARGET_DIR
-            = "src/main/generated-sources";
+    protected static final String WORK_DIR
+            = "src/main/torque-gen/work";
 
     /**
-     * the root directory of the whole maven2 project.
+     * The root directory of the whole maven2 project.
      */
     private File projectRoot;
 
     /**
+     * The output directory map which contains the mapping
+     * from output directory key to output directory.
+     */
+    private Map<String, File> outputDirectoryMap = new HashMap<String, File>();
+
+    /**
      * Constructor.
      *
      * @param projectRoot path to the project root directory, not null.
@@ -82,6 +104,10 @@ public abstract class Maven2ProjectPaths
             throw new NullPointerException("projectRoot is null");
         }
         this.projectRoot = projectRoot;
+        outputDirectoryMap.put(null, new File(projectRoot, DEFAULT_OUTPUT_DIR));
+        outputDirectoryMap.put(
+                MODIFIABLE_OUTPUT_DIR_KEY,
+                new File(projectRoot, MODIFIABLE_OUTPUT_DIR));
     }
 
     public abstract File getConfigurationPath();
@@ -99,25 +125,51 @@ public abstract class Maven2ProjectPaths
     }
 
     /**
-     * Returns the default subdirectory for the files which are generated
-     * each time anew, relative to the project root.
+     * Returns the output directory map which contains the mapping
+     * from output directory key to output directory.
+     *
+     * @return the unmodifiable output directory map, not null.
+     *         Contains a mapping for the keys null and "modifiable".
      *
-     * @return the subdirectory for the generated files, not null.
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
      */
-    public File getNewFileTargetPath()
+    public Map<String, File> getOutputDirectoryMap()
     {
-        return new File(projectRoot, NEW_FILE_TARGET_DIR);
+        return Collections.unmodifiableMap(outputDirectoryMap);
+    }
+
+    /**
+     * Returns the output directory for a given output directory key.
+     *
+     * @param outputDirKey the output directory key, or null for the default
+     *        output directory.
+     *
+     * @return the output directory for the key,
+     *         relative to the current directory, or absolute, not null.
+     *
+     * @throws IllegalArgumentException if the outputDirKey is unknown.
+     */
+    public File getOutputDirectory(String outputDirKey)
+    {
+        File result = outputDirectoryMap.get(outputDirKey);
+        if (result == null)
+        {
+            throw new IllegalArgumentException(
+                    "unknown outputDirKey " + outputDirKey);
+        }
+        return result;
     }
 
     /**
-     * Returns the default subdirectory for files which are not generated
-     * each time anew, relative to the project root.
+     * Returns the default subdirectory where the torque generator can store
+     * internal files.
      *
-     * @return the subdirectory for the generated files, not null.
+     * @return the work subdirectory, not null.
      */
-    public File getModifiedFileTargetPath()
+    public File getWorkDirectory()
     {
-        return new File(projectRoot, MODIFIED_FILE_TARGET_DIR);
+        return new File(projectRoot, WORK_DIR);
     }
 
     /**

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/ProjectPaths.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/ProjectPaths.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/ProjectPaths.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/paths/ProjectPaths.java Tue Oct 25 01:23:02 2011
@@ -20,6 +20,7 @@ package org.apache.torque.generator.conf
  */
 
 import java.io.File;
+import java.util.Map;
 
 /**
  * Provides the default paths which Torque generator needs to interact with
@@ -39,6 +40,9 @@ public interface ProjectPaths
      *         may (but must not) be null if no configuration is contained
      *         in the surrounding project;
      *         must be null if the configuration is read from the class path.
+     *
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
      */
     File getConfigurationPath();
 
@@ -49,6 +53,9 @@ public interface ProjectPaths
      *         if the configuration is read from the file system or from
      *         a jar file. Must not be null if the configuration is read
      *         from the class path.
+     *
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
      */
     String getConfigurationPackage();
 
@@ -62,26 +69,51 @@ public interface ProjectPaths
      * where the sources are located.
      *
      * @return the path for the source files, not null.
+     *
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
      */
     File getDefaultSourcePath();
 
     /**
-     * Returns the path to the default directory for the generated output
-     * if the generated output is created anew each time.
-     * The path must either be absolute or relative to the current working
+     * Returns the path to the base directory for the generated output
+     * for the given output key.
+     *
+     * The returned path is either absolute or relative to the current working
      * directory.
      *
-     * @return the path for the generated files, not null.
+     * @param outputDirKey the key which output directory should be returned.
+     *        Null is the key for the default output directory
+     *        and is always mapped to a non-null value.
+     *
+     * @return the base directory for the generated files, not null.
+     *
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
+     * @throws IllegalArgumentException if the outputDirKey is unknown.
      */
-    File getNewFileTargetPath();
+    File getOutputDirectory(String outputDirKey);
 
     /**
-     * Returns the path to the default directory for the generated output
-     * if the generated output is not created anew each time.
-     * The path must either be absolute or relative to the current working
-     * directory.
+     * Returns the output directory map which contains the mapping
+     * from output directory key to output directory.
+     *
+     * @return the output directory map, not null, contains at least
+     *         a mapping for the key null.
+     *
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
+     */
+    Map<String, File> getOutputDirectoryMap();
+
+    /**
+     * Returns the work directory where the torque generator can store
+     * internal files.
+     *
+     * @return the work directory, not null.
      *
-     * @return the path for the generated files, not null.
+     * @throws IllegalStateException if the current state of the object
+     *         is not valid.
      */
-    File getModifiedFileTargetPath();
+    File getWorkDirectory();
 }



---------------------------------------------------------------------
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