You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2011/10/25 03:23:06 UTC

svn commit: r1188480 [2/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...

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/AppendToTargetFileStrategy.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/AppendToTargetFileStrategy.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/AppendToTargetFileStrategy.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/AppendToTargetFileStrategy.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,125 @@
+package org.apache.torque.generator.control;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.torque.generator.GeneratorException;
+import org.apache.torque.generator.configuration.UnitConfiguration;
+
+/**
+ * A handler which implements the strategy to append the generation result
+ * to the existing target files.
+ *
+ * @version $Id: $
+ */
+public class AppendToTargetFileStrategy implements ExistingTargetStrategy
+{
+    /** The strategy name "append". */
+    public static final String STRATEGY_NAME = "append";
+
+    /**
+     * Will be called before the generation is started and decides whether
+     * the generation process for this file should proceed.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     *
+     * @return true always.
+     */
+    public boolean beforeGeneration(
+            String outputDirKey,
+            String outputPath,
+            String encoding,
+            UnitConfiguration unitConfiguration)
+    {
+        return true;
+    }
+
+    /**
+     * Processes the results of the generation.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param generationResult the result of the generation, not null.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     * @throws GeneratorException on an error.
+     */
+    public void afterGeneration(
+                String outputDirKey,
+                String outputPath,
+                String encoding,
+                String generationResult,
+                UnitConfiguration unitConfiguration)
+            throws GeneratorException
+    {
+        File outputFile = ControllerHelper.getOutputFile(
+                outputDirKey,
+                outputPath,
+                unitConfiguration);
+        try
+        {
+            String originalContent = "";
+            if (outputFile.exists())
+            {
+                originalContent = FileUtils.readFileToString(
+                        outputFile,
+                        encoding);
+            }
+            FileUtils.writeStringToFile(
+                    outputFile,
+                    originalContent + generationResult,
+                    encoding);
+        }
+        catch (IOException e)
+        {
+            throw new ControllerException(
+                    "Could not write file \""
+                        + outputFile.getAbsolutePath()
+                        + "\"",
+                    e);
+        }
+    }
+
+    /**
+     * Returns the name of the existing target strategy.
+     *
+     * @return "replace"
+     */
+    public String getStrategyName()
+    {
+        return STRATEGY_NAME;
+    }
+}

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java Tue Oct 25 01:23:02 2011
@@ -20,9 +20,10 @@ package org.apache.torque.generator.cont
  */
 
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
@@ -57,6 +58,23 @@ public class Controller
     /** The logger. */
     private static Log log = LogFactory.getLog(Controller.class);
 
+    /**
+     * All known ExistingTargetStrategies.
+     * TODO move to a better place.
+     */
+    private static List<ExistingTargetStrategy> EXISTING_TARGET_STRATEGIES;
+
+    static
+    {
+        List<ExistingTargetStrategy> existingTargetStrategies
+            = new ArrayList<ExistingTargetStrategy>();
+        existingTargetStrategies.add(new ReplaceTargetFileStrategy());
+        existingTargetStrategies.add(new SkipExistingTargetFileStrategy());
+        existingTargetStrategies.add(new MergeTargetFileStrategy());
+        existingTargetStrategies.add(new AppendToTargetFileStrategy());
+        EXISTING_TARGET_STRATEGIES = Collections.unmodifiableList(
+                existingTargetStrategies);
+    }
 
     /**
      * Executes the controller action.
@@ -84,8 +102,7 @@ public class Controller
         {
             processGenerationUnit(
                     controllerState,
-                    unitConfiguration,
-                    configuration);
+                    unitConfiguration);
         }
         controllerState.getVariableStore().endGeneration();
     }
@@ -112,7 +129,7 @@ public class Controller
 
     /**
      * Reads the configuration.
-     * 
+     *
      * @param unitDescriptors the unit descriptors for which the configuration
      *        should be read, not null, not empty.
      *
@@ -134,18 +151,16 @@ public class Controller
 
     /**
      * Processes a unit of generation.
-     * 
+     *
      * @param controllerState the controller state, not null.
      * @param unitConfiguration the configuration of the generation unit
      *        to process, not null.
-     * @param configuration the generator configuration, not null.
      *
      * @throws GeneratorException if a generation error occurs.
      */
     protected void processGenerationUnit(
                 ControllerState controllerState,
-                UnitConfiguration unitConfiguration,
-                Configuration configuration)
+                UnitConfiguration unitConfiguration)
             throws GeneratorException
     {
         log.debug("processGenerationUnit() : start");
@@ -158,46 +173,28 @@ public class Controller
             processOutput(
                     output,
                     controllerState,
-                    unitConfiguration,
-                    configuration);
+                    unitConfiguration);
         }
     }
 
     /**
      * Processes an output definition.
-     * 
+     *
      * @param output the output definition to process, not null.
      * @param controllerState the controller state, not null.
      * @param unitConfiguration the configuration of the generation unit
      *        to process, not null.
-     * @param configuration the generator configuration, not null.
      *
      * @throws GeneratorException if a generation error occurs.
      */
     private void processOutput(
                 Output output,
                 ControllerState controllerState,
-                UnitConfiguration unitConfiguration,
-                Configuration configuration)
+                UnitConfiguration unitConfiguration)
             throws GeneratorException
     {
         log.debug("Processing output " + output.getFilename());
         controllerState.setOutput(output);
-        File targetDirectory;
-        if (output.isAlwaysNew())
-        {
-            targetDirectory
-                = unitConfiguration.getNewFileTargetDirectory();
-            log.debug("Using newFileTargetDirectory "
-                    + targetDirectory);
-        }
-        else
-        {
-            targetDirectory
-                = unitConfiguration.getModifiedFileTargetDirectory();
-            log.debug("Using modifiedFileTargetDirectory "
-                    + targetDirectory);
-        }
 
         SourceProvider sourceProvider = output.getSourceProvider();
         SourceProvider overrideSourceProvider
@@ -207,13 +204,13 @@ public class Controller
             if (overrideSourceProvider.isInit())
             {
                 overrideSourceProvider.reset(
-                        configuration.getConfigurationHandlers(),
+                        unitConfiguration.getConfigurationHandlers(),
                         controllerState);
             }
             sourceProvider = overrideSourceProvider;
         }
         sourceProvider.init(
-                configuration.getConfigurationHandlers(),
+                unitConfiguration.getConfigurationHandlers(),
                 controllerState);
         if (!sourceProvider.hasNext())
         {
@@ -226,30 +223,26 @@ public class Controller
             processSourceInOutput(
                     source,
                     output,
-                    controllerState, 
-                    targetDirectory,
+                    controllerState,
                     unitConfiguration);
         }
     }
 
     /**
      * Processes a single source in an output definition.
-     * 
+     *
      * @param source the source to process, not null.
      * @param output the output to which the source belongs, not null.
      * @param controllerState the controller state, not null.
-     * @param targetDirectory the directory to which the output
-     *        should be written, not null.
      * @param unitConfiguration the configuration of the current generation
      *        unit, not null.
-     * 
+     *
      * @throws GeneratorException if a generation error occurs.
      */
     private void processSourceInOutput(
                 Source source,
                 Output output,
                 ControllerState controllerState,
-                File targetDirectory,
                 UnitConfiguration unitConfiguration)
             throws GeneratorException
     {
@@ -281,7 +274,6 @@ public class Controller
                     startElement,
                     output,
                     source,
-                    targetDirectory,
                     unitConfiguration,
                     controllerState);
         }
@@ -354,8 +346,6 @@ public class Controller
      * @param startElement the start element to process.
      * @param output the current output, not null.
      * @param source the current source, not null.
-     * @param targetDirectory the directory in which the output files
-     *        should be processed, not null
      * @param unitConfiguration the current unit configuration, not null.
      * @param controllerState the current controller state, not null.
      *
@@ -369,10 +359,9 @@ public class Controller
                 SourceElement startElement,
                 Output output,
                 Source source,
-                File targetDirectory,
                 UnitConfiguration unitConfiguration,
                 ControllerState controllerState)
-            throws ControllerException, GeneratorException
+            throws GeneratorException
     {
         if (startElement == null)
         {
@@ -386,29 +375,46 @@ public class Controller
         log.debug("Processing new startElement "
                 + startElement.getName());
 
-        createOutputFilename(output, controllerState);
-        controllerState.setOutputFile(
-                new File(
-                    targetDirectory,
-                    output.getFilename()));
-
-        if (output.isSkipIfExists())
-        {
-            File outputFile
-                    = controllerState.getOutputFile();
-            if (outputFile.exists())
+        ExistingTargetStrategy existingTargetStrategy = null;
+        for (ExistingTargetStrategy candidate : EXISTING_TARGET_STRATEGIES)
+        {
+            if (candidate.getStrategyName().equals(
+                    output.getExistingTargetStrategy()))
             {
-                log.info("Output file "
-                        + outputFile.getAbsolutePath()
-                        + " exists and skipIfExists"
-                        + " is set to true, skipping");
-                return;
+                existingTargetStrategy = candidate;
+                break;
             }
         }
+        if (existingTargetStrategy == null)
+        {
+            throw new ControllerException("existingTargetStrategy "
+                    + output.getExistingTargetStrategy()
+                    + " not found");
+        }
+
+        createOutputFilename(output, controllerState);
+        File outputFile = ControllerHelper.getOutputFile(
+                output.getOutputDirKey(),
+                output.getFilename(),
+                unitConfiguration);
+        controllerState.setOutputFile(outputFile);
+
+        if (!existingTargetStrategy.beforeGeneration(
+                output.getOutputDirKey(),
+                output.getFilename(),
+                output.getEncoding(),
+                unitConfiguration))
+        {
+            log.info("Skipping generation of File "
+                    + outputFile.getAbsolutePath()
+                    + " because of existingTargetStgrategy "
+                    + existingTargetStrategy.getStrategyName());
+            return;
+        }
         if (log.isInfoEnabled())
         {
             log.info("Start generation of File "
-                    + controllerState.getOutputFile());
+                    + outputFile.getAbsolutePath());
         }
 
         OutletReference contentOutletConfiguration
@@ -471,39 +477,12 @@ public class Controller
         String result = outlet.execute(controllerState);
         outlet.afterExecute(controllerState);
 
-        FileWriter fileWriter = null;
-        try
-        {
-            fileWriter = new FileWriter(
-                    controllerState.getOutputFile());
-            fileWriter.append(result);
-        }
-        catch (IOException e)
-        {
-            throw new ControllerException(
-                    "Could not write file \""
-                        + controllerState.getOutputFile().getAbsolutePath()
-                        + "\"",
-                    e);
-        }
-        finally
-        {
-            if (fileWriter != null)
-            {
-                try
-                {
-                    fileWriter.close();
-                }
-                catch (IOException e)
-                {
-                    throw new ControllerException(
-                        "Could not close stream for file \""
-                            + controllerState.getOutputFile().getAbsolutePath()
-                            + "\"",
-                        e);
-                }
-            }
-        }
+        existingTargetStrategy.afterGeneration(
+                output.getOutputDirKey(),
+                output.getFilename(),
+                output.getEncoding(),
+                result,
+                unitConfiguration);
 
         controllerState.getVariableStore().endFile();
         if (log.isDebugEnabled())

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,64 @@
+package org.apache.torque.generator.control;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+
+import org.apache.torque.generator.configuration.UnitConfiguration;
+
+/**
+ * Helper methods for the controller.
+ *
+ * @version $Id: $
+ */
+public final class ControllerHelper
+{
+    /**
+     * Private constructor for helper class.
+     */
+    private ControllerHelper()
+    {
+    }
+
+    /**
+     * Calculates the location of the target file from the file name and
+     * the unit configuration.
+     *
+     * @param outputDirKey the key for the output directory to use.
+     * @param outputPath the output path, not null.
+     * @param unitConfiguration the unit configuration, not null.
+     *
+     * @return the output File, not null.
+     */
+    static File getOutputFile(
+            String outputDirKey,
+            String outputPath,
+            UnitConfiguration unitConfiguration)
+    {
+        File targetDirectory
+                = unitConfiguration.getOutputDirectory(outputDirKey);
+        File outputFile = new File(
+                targetDirectory,
+                outputPath);
+        return outputFile;
+    }
+
+
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ExistingTargetStrategy.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ExistingTargetStrategy.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ExistingTargetStrategy.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ExistingTargetStrategy.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,89 @@
+package org.apache.torque.generator.control;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.torque.generator.GeneratorException;
+import org.apache.torque.generator.configuration.UnitConfiguration;
+
+/**
+ * A handler which implements a strategy on how to deal with existing targets.
+ *
+ * @version $Id: $
+ */
+public interface ExistingTargetStrategy
+{
+    /**
+     * Will be called before the generation is started and decides whether
+     * the generation process for this file should proceed.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     *
+     * @return true if generation should proceed,
+     *         false if generation should be aborted.
+     *
+     * @throws GeneratorException on an error.
+     */
+    boolean beforeGeneration(
+            String outputDirKey,
+            String outputPath,
+            String encoding,
+            UnitConfiguration unitConfiguration)
+        throws GeneratorException;
+
+    /**
+     * Processes the results of the generation.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param generationResult the result of the generation, not null.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     *
+     * @throws GeneratorException on an error.
+     */
+    void afterGeneration(
+                String outputDirKey,
+                String outputPath,
+                String encoding,
+                String generationResult,
+                UnitConfiguration unitConfiguration)
+            throws GeneratorException;
+
+    /**
+     * Returns the name of the existing target strategy.
+     *
+     * @return the strategy name, not null, must be different from the names of
+     *         other strategies.
+     */
+    String getStrategyName();
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/MergeTargetFileStrategy.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/MergeTargetFileStrategy.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/MergeTargetFileStrategy.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/MergeTargetFileStrategy.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,229 @@
+package org.apache.torque.generator.control;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.generator.GeneratorException;
+import org.apache.torque.generator.configuration.UnitConfiguration;
+import org.apache.torque.generator.merge.ThreeWayMerger;
+
+/**
+ * A handler which implements the strategy to replace existing target files.
+ *
+ * @version $Id: $
+ */
+public class MergeTargetFileStrategy implements ExistingTargetStrategy
+{
+    /** The strategy name "replace". */
+    public static final String STRATEGY_NAME = "merge";
+
+    /** The subdirectory in the work directory<. */
+    public static final String WORK_SUBDIR = "raw-generated";
+
+    /** The classlogger. */
+    private static Log log = LogFactory.getLog(MergeTargetFileStrategy.class);
+
+    /** The merger. */
+    private ThreeWayMerger merger = new ThreeWayMerger();
+
+    /**
+     * Will be called before the generation is started and decides whether
+     * the generation process for this file should proceed.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     *
+     * @return true always.
+     */
+    public boolean beforeGeneration(
+            String outputDirKey,
+            String outputPath,
+            String encoding,
+            UnitConfiguration unitConfiguration)
+    {
+        return true;
+    }
+
+    /**
+     * Processes the results of the generation.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputFile the location to which the output should be written.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param generationResult the result of the generation, not null.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     * @throws GeneratorException on an error.
+     */
+    public void afterGeneration(
+                String outputDirKey,
+                String outputPath,
+                String encoding,
+                String generationResult,
+                UnitConfiguration unitConfiguration)
+            throws GeneratorException
+    {
+        File generationStorageDir
+                = new File(unitConfiguration.getWorkDirectory(), WORK_SUBDIR);
+        File generationStorageFile;
+        if (outputDirKey == null)
+        {
+            generationStorageFile
+                    = new File(generationStorageDir,
+                            FilenameUtils.concat("default", outputPath));
+        }
+        else
+        {
+            generationStorageFile
+                    = new File(generationStorageDir,
+                        FilenameUtils.concat("other",
+                            FilenameUtils.concat(outputDirKey, outputPath)));
+        }
+        String oldGenerationContent = readFileToString(
+                generationStorageFile,
+                encoding);
+
+        File targetFile = ControllerHelper.getOutputFile(
+                outputDirKey,
+                outputPath,
+                unitConfiguration);
+        String oldTargetContent = readFileToString(
+                targetFile,
+                encoding);
+
+        String newTargetContent = null;
+        if (oldTargetContent == null)
+        {
+            log.debug("no old target content found, using generation result");
+            newTargetContent = generationResult;
+        }
+        else if (oldGenerationContent == null)
+        {
+            log.info("no old generation content found,"
+                    + "using old target content."
+                    + " This is a bit unusual, but may be ok"
+                    + " depending on the circumstances");
+            newTargetContent = generationResult;
+        }
+        else
+        {
+            log.debug("merging generation result and old target content");
+            newTargetContent = merger.merge(
+                    oldGenerationContent,
+                    generationResult,
+                    oldTargetContent,
+                    encoding);
+        }
+        writeStringToFile(targetFile, newTargetContent, encoding);
+        writeStringToFile(generationStorageFile, generationResult, encoding);
+    }
+
+    /**
+     * Returns the name of the existing target strategy.
+     *
+     * @return "merge"
+     */
+    public String getStrategyName()
+    {
+        return STRATEGY_NAME;
+    }
+
+    /**
+     * Reads a String to a file.
+     *
+     * @param file the file to read, not null.
+     * @param charset the character set to use for reading the file,
+     *        or null for platform default.
+     * @return the file's contents, or null if the file does not exist.
+     *
+     * @throws ControllerException if an error occurs while reading the file.
+     */
+    private String readFileToString(
+                File file,
+                String charset)
+            throws ControllerException
+    {
+        String result = null;
+        if (file.exists())
+        {
+            try
+            {
+                result = FileUtils.readFileToString(
+                        file,
+                        charset);
+            }
+            catch (IOException e)
+            {
+                throw new ControllerException(
+                        "Could not read file \""
+                            + file.getAbsolutePath()
+                            + "\"",
+                        e);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Writes a String to a file.
+     *
+     * @param file the location to write to, not null.
+     * @param content the content of the file, not null.
+     * @param charset the character set to use for writing the file,
+     *        or null for platform default.
+     *
+     * @throws ControllerException if writing the file fails.
+     */
+    private void writeStringToFile(
+                File file,
+                String content,
+                String charset)
+            throws ControllerException
+    {
+        try
+        {
+            FileUtils.writeStringToFile(file, content, charset);
+        }
+        catch (IOException e)
+        {
+            throw new ControllerException(
+                    "Could not write file \""
+                        + file.getAbsolutePath()
+                        + "\"",
+                    e);
+        }
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ReplaceTargetFileStrategy.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ReplaceTargetFileStrategy.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ReplaceTargetFileStrategy.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ReplaceTargetFileStrategy.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,114 @@
+package org.apache.torque.generator.control;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.torque.generator.GeneratorException;
+import org.apache.torque.generator.configuration.UnitConfiguration;
+
+/**
+ * A handler which implements the strategy to replace existing target files.
+ *
+ * @version $Id: $
+ */
+public class ReplaceTargetFileStrategy implements ExistingTargetStrategy
+{
+    /** The strategy name "replace". */
+    public static final String STRATEGY_NAME = "replace";
+
+    /**
+     * Will be called before the generation is started and decides whether
+     * the generation process for this file should proceed.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     *
+     * @return true always.
+     */
+    public boolean beforeGeneration(
+            String outputDirKey,
+            String outputPath,
+            String encoding,
+            UnitConfiguration unitConfiguration)
+    {
+        return true;
+    }
+
+    /**
+     * Processes the results of the generation.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param encoding The character encoding of the generated file,
+     *        or null for the platform default encoding.
+     * @param generationResult the result of the generation, not null.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     * @throws GeneratorException on an error.
+     */
+    public void afterGeneration(
+                String outputDirKey,
+                String outputPath,
+                String encoding,
+                String generationResult,
+                UnitConfiguration unitConfiguration)
+            throws GeneratorException
+    {
+        File outputFile = ControllerHelper.getOutputFile(
+                outputDirKey,
+                outputPath,
+                unitConfiguration);
+        try
+        {
+            FileUtils.writeStringToFile(outputFile, generationResult, encoding);
+        }
+        catch (IOException e)
+        {
+            throw new ControllerException(
+                    "Could not write file \""
+                        + outputFile.getAbsolutePath()
+                        + "\"",
+                    e);
+        }
+    }
+
+    /**
+     * Returns the name of the existing target strategy.
+     *
+     * @return "replace"
+     */
+    public String getStrategyName()
+    {
+        return STRATEGY_NAME;
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/SkipExistingTargetFileStrategy.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/SkipExistingTargetFileStrategy.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/SkipExistingTargetFileStrategy.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/SkipExistingTargetFileStrategy.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,73 @@
+package org.apache.torque.generator.control;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+
+import org.apache.torque.generator.configuration.UnitConfiguration;
+
+/**
+ * A handler which implements the strategy to skip existing target files.
+ *
+ * @version $Id: $
+ */
+public class SkipExistingTargetFileStrategy extends ReplaceTargetFileStrategy
+{
+    /** The strategy name "skip". */
+    public static final String STRATEGY_NAME = "skip";
+
+    /**
+     * Will be called before the generation is started and decides whether
+     * the generation process for this file should proceed.
+     *
+     * @param outputDirKey the key for the output directory
+     *        into which the generated file should be written,
+     *        null for the default output directory.
+     * @param outputPath the path to which the output should be written,
+     *        relative to the output base directory.
+     * @param unitConfiguration the configuration of the current configuration
+     *        unit, not null.
+     *
+     * @return true if the target file does not exist, false otherwise.
+     */
+     @Override
+     public boolean beforeGeneration(
+             String outputDirKey,
+             String outputPath,
+             String encoding,
+             UnitConfiguration unitConfiguration)
+    {
+        File outputFile = ControllerHelper.getOutputFile(
+                outputDirKey,
+                outputPath,
+                unitConfiguration);
+        return !outputFile.exists();
+    }
+
+    /**
+     * Returns the name of the existing target strategy.
+     *
+     * @return "skip"
+     */
+    public String getStrategyName()
+    {
+        return STRATEGY_NAME;
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/merge/ThreeWayMerger.java Tue Oct 25 01:23:02 2011
@@ -0,0 +1,103 @@
+package org.apache.torque.generator.merge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.torque.generator.GeneratorException;
+import org.eclipse.jgit.diff.RawText;
+import org.eclipse.jgit.diff.RawTextComparator;
+import org.eclipse.jgit.merge.MergeAlgorithm;
+import org.eclipse.jgit.merge.MergeFormatter;
+import org.eclipse.jgit.merge.MergeResult;
+
+/**
+ * Can execute a three-way merge. This class is thread safe.
+ * 
+ * @version $Id: $
+ */
+public class ThreeWayMerger
+{
+    /**
+     * Performs a three-way merge.
+     * 
+     * @param base the base from which the other two versions are derived,
+     *        not null.
+     * @param generated the newly generated text, not null.
+     * @param edited the possibly edited text, not null.
+     * @param charsetName the name of the character set, not null.
+     * @return the merge result, not null.
+     * 
+     * @throws GeneratorException if merging fails.
+     */
+    public String merge(
+                String base,
+                String generated,
+                String edited,
+                String charsetName)
+            throws GeneratorException
+    {
+        MergeAlgorithm mergeAlgorithm = new MergeAlgorithm();
+        MergeResult<RawText> mergeResult;
+        try
+        {
+            mergeResult = mergeAlgorithm.merge(
+                    RawTextComparator.DEFAULT,
+                    new RawText(base.getBytes(charsetName)), 
+                    new RawText(generated.getBytes(charsetName)), 
+                    new RawText(edited.getBytes(charsetName)));
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            throw new GeneratorException(
+                    "unknown character set " + charsetName,
+                    e);
+        }
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        try
+        {
+            new MergeFormatter().formatMerge(
+                    outputStream,
+                    mergeResult,
+                    "base",
+                    "generated",
+                    "edited",
+                    charsetName);
+        }
+        catch (IOException e)
+        {
+            throw new GeneratorException("could nor render merge result", e);
+        }
+        try
+        {
+            String result 
+                = new String(outputStream.toByteArray(), charsetName);
+            return result;
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            throw new GeneratorException(
+                    "unknown character set " + charsetName,
+                    e);
+        }
+    }
+}

Modified: db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.xsd
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.xsd?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.xsd (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.xsd Tue Oct 25 01:23:02 2011
@@ -96,11 +96,37 @@
         </documentation>
       </annotation>
     </attribute>
-    <attribute name="skipIfExists" type="boolean" use="optional">
+    <attribute name="encoding" type="string" use="optional">
+      <annotation>
+        <documentation>
+          The character encoding in which this file is written.
+          Default is the platform's default encoding.
+        </documentation>
+      </annotation>
+    </attribute>
+    <attribute name="existingTargetStrategy" use="optional">
       <annotation>
         <documentation>
           If set to true, the file will be skipped if it already exists.
-          Default is false.
+          Default is "replace".
+        </documentation>
+      </annotation>
+      <simpleType>
+        <restriction base="string">
+          <enumeration value="replace"/>
+          <enumeration value="skip"/>
+          <enumeration value="append"/>
+          <enumeration value="merge"/>
+        </restriction>
+      </simpleType>
+    </attribute>
+    <attribute name="outputDirKey" type="string" use="optional">
+      <annotation>
+        <documentation>
+          The key for the base directory into which the output is written
+          (The corresponding directory for the key is defined when running
+          the generator).
+          If not set, the default targetDirKey is used.
         </documentation>
       </annotation>
     </attribute>

Modified: db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/outlet.xsd
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/outlet.xsd?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/outlet.xsd (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/outlet.xsd Tue Oct 25 01:23:02 2011
@@ -70,6 +70,7 @@
         <attribute name="optionsInContext" type="string" use="optional"/>
         <attribute name="sourceAttributesInContext" type="string" use="optional"/>
         <attribute name="variablesInContext" type="string" use="optional"/>
+        <attribute name="encoding" type="string" use="optional"/>
       </extension>
     </complexContent>
   </complexType>

Modified: db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen-parent/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen-parent/conf/control.xml?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen-parent/conf/control.xml (original)
+++ db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen-parent/conf/control.xml Tue Oct 25 01:23:02 2011
@@ -32,7 +32,7 @@
       systemId="http://db.apache.org/torque/parent.xsd"
       resource="parent.xsd" />
 
-  <output name="parentOutput">
+  <output name="parentOutput" outputDirKey="parentOutputDirKeyFromParent">
     <filenameOutlet xsi:type="javaOutlet" 
         class="org.apache.torque.generator.java.JavaOutlet">
       <foo>ParentFoo</foo>
@@ -48,7 +48,7 @@
     </source>
     <outlet name="org.apache.torque.generator.test.readConfiguration.testParentOutlet"/>
   </output>
-  <output name="secondOutput">
+  <output name="secondOutput" outputDirKey="secondOutputDirKeyFromParent" existingTargetStrategy="skip">
     <filenameOutlet xsi:type="velocityOutlet" path="testTemplate.vm"/>
     <source xsi:type="fileSource"
         format="properties"

Modified: db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen/conf/control.xml?rev=1188480&r1=1188479&r2=1188480&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen/conf/control.xml (original)
+++ db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen/conf/control.xml Tue Oct 25 01:23:02 2011
@@ -34,7 +34,7 @@
       resource="override.xsd" />
 
 
-  <output name="org.apache.torque.generator.firstOutput" skipIfExists="true">
+  <output name="org.apache.torque.generator.firstOutput" existingTargetStrategy="skip">
     <filenameOutlet xsi:type="javaOutlet" class="org.apache.torque.generator.java.JavaOutlet">
       <foo>Foo</foo>
       <bar>Bar</bar>
@@ -42,7 +42,7 @@
     <source xsi:type="fileSource" format="xml"/>
     <outlet name="org.apache.torque.generator.test.readConfiguration.javaOutlet"/>
   </output>
-  <output name="secondOutput">
+  <output name="secondOutput" outputDirKey="secondOutputDirKey">
     <filenameOutlet xsi:type="velocityOutlet" path="testTemplate.vm"/>
     <source xsi:type="fileSource" 
         elements="properties/entry"
@@ -56,7 +56,7 @@
     </source>
     <outlet name="org.apache.torque.generator.test.readConfiguration.anotherOutlet"/>
   </output>
-  <output name="thirdOutput" file="outputFileName">
+  <output name="thirdOutput" file="outputFileName" existingTargetStrategy="append" outputDirKey="thirdOutputDirKey">
     <source xsi:type="jdbcMetadataSource"
         driverOption="jdbcDriver"
         urlOption="jdbcUrl"

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/control.xml?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/control.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/control.xml Tue Oct 25 01:23:02 2011
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<control
+    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"
+    loglevel="debug">
+  <output name="output1" file="output1.txt" existingTargetStrategy="append">
+    <source xsi:type="fileSource" elements="properties">
+      <include>source1.properties</include>
+    </source>
+    <outlet name="org.apache.torque.generator.velocity.propertiesCopy" />
+  </output>
+  <output name="output2" file="output2.txt" existingTargetStrategy="append" outputDirKey="outputDirKey2">
+    <source xsi:type="fileSource" elements="properties">
+      <include>source2.properties</include>
+    </source>
+    <outlet name="org.apache.torque.generator.velocity.propertiesCopy" />
+  </output>
+</control>
+  
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/outlets/output.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/outlets/output.xml?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/outlets/output.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/outlets/output.xml Tue Oct 25 01:23:02 2011
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<outlets xmlns="http://db.apache.org/torque/4.0/generator/configuration"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <outlet name="org.apache.torque.generator.velocity.propertiesCopy"
+      xsi:type="velocityOutlet" 
+      path="propertiesCopy.vm">
+    <mergepoint name="properties">
+      <action xsi:type="traverseAllAction" element="entry" 
+          outlet="org.apache.torque.generator.velocity.propertyCopy"/>
+    </mergepoint>
+  </outlet>
+  <outlet name="org.apache.torque.generator.velocity.propertyCopy"
+      xsi:type="velocityOutlet" 
+      path="propertyCopy.vm"/>
+</outlets>
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source1.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source1.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source1.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source1.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source2.properties
+fromDir = existingTargetStrategyTest.appendStrategy
+propertyName1 = propertyValue1
+propertyWhichWasInsertedLater = insertedValue
+propertyName2 = propertyValue2
+propertyName3 = propertyValue3
+propertyWhichIsModifiedLater = modifiedValue
+propertyName4 = propertyValue4

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source2.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source2.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source2.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/src/source2.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source2.properties
+fromDir = existingTargetStrategyTest.appendStrategy
+otherPropertyName1 = propertyValue1
+otherPropertyWhichWasInsertedLater = insertedValue
+otherPropertyName2 = propertyValue2
+otherPropertyName3 = propertyValue3
+otherPropertyWhichIsModifiedLater = modifiedValue
+otherPropertyName4 = propertyValue4

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertiesCopy.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertiesCopy.vm?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertiesCopy.vm (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertiesCopy.vm Tue Oct 25 01:23:02 2011
@@ -0,0 +1,18 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+$torqueGen.mergepoint("properties")
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertyCopy.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertyCopy.vm?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertyCopy.vm (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/templates/propertyCopy.vm Tue Oct 25 01:23:02 2011
@@ -0,0 +1,18 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+$key = ${value}

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/control.xml?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/control.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/control.xml Tue Oct 25 01:23:02 2011
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<control
+    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"
+    loglevel="debug">
+  <output name="output1" file="output1.txt">
+    <source xsi:type="fileSource" elements="properties">
+      <include>source1.properties</include>
+    </source>
+    <outlet name="org.apache.torque.generator.velocity.propertiesCopy" />
+  </output>
+  <output name="output2" file="output2.txt" outputDirKey="outputDirKey2">
+    <source xsi:type="fileSource" elements="properties">
+      <include>source2.properties</include>
+    </source>
+    <outlet name="org.apache.torque.generator.velocity.propertiesCopy" />
+  </output>
+</control>
+  
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/outlets/output.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/outlets/output.xml?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/outlets/output.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/outlets/output.xml Tue Oct 25 01:23:02 2011
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<outlets xmlns="http://db.apache.org/torque/4.0/generator/configuration"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <outlet name="org.apache.torque.generator.velocity.propertiesCopy"
+      xsi:type="velocityOutlet" 
+      path="propertiesCopy.vm">
+    <mergepoint name="properties">
+      <action xsi:type="traverseAllAction" element="entry" 
+          outlet="org.apache.torque.generator.velocity.propertyCopy"/>
+    </mergepoint>
+  </outlet>
+  <outlet name="org.apache.torque.generator.velocity.propertyCopy"
+      xsi:type="velocityOutlet" 
+      path="propertyCopy.vm"/>
+</outlets>
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source1.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source1.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source1.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source1.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source1.properties
+fromDir = existingTargetStrategyTest.initial
+propertyName1 = propertyValue1
+propertyName2 = propertyValue2
+propertyWhichIsDeletedLater = valueToDelete
+propertyName3 = propertyValue3
+propertyWhichIsModifiedLater = valueToModify
+propertyName4 = propertyValue4

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source2.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source2.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source2.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/src/source2.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source2.properties
+fromDir = existingTargetStrategyTest.initial
+otherPropertyName1 = propertyValue1
+otherPropertyName2 = propertyValue2
+otherPropertyWhichIsDeletedLater = valueToDelete
+otherPropertyName3 = propertyValue3
+otherPropertyWhichIsModifiedLater = valueToModify
+otherPropertyName4 = propertyValue4

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertiesCopy.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertiesCopy.vm?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertiesCopy.vm (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertiesCopy.vm Tue Oct 25 01:23:02 2011
@@ -0,0 +1,18 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+$torqueGen.mergepoint("properties")
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertyCopy.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertyCopy.vm?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertyCopy.vm (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/templates/propertyCopy.vm Tue Oct 25 01:23:02 2011
@@ -0,0 +1,18 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+$key = ${value}

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected1.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected1.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected1.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected1.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source1.properties
+fromDir = existingTargetStrategyTest.mergeStrategy
+propertyName1 = propertyValue1
+propertyWhichWasInsertedLater = insertedValue
+propertyName2 = propertyValue2
+propertyName3 = propertyValue3
+<<<<<<< generated
+propertyWhichIsModifiedLater = modifiedValueInConflictSourceDir
+=======
+propertyWhichIsModifiedLater = modifiedValueInNormalSourceDir
+>>>>>>> edited
+propertyName4 = propertyValue4
+propertyInsertedInConflictSourceDir = insertedValue2

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected2.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected2.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected2.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/expected2.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source2.properties
+fromDir = existingTargetStrategyTest.mergeStrategy
+otherPropertyName1 = propertyValue1
+otherPropertyWhichWasInsertedLater = insertedValue
+otherPropertyName2 = propertyValue2
+otherPropertyName3 = propertyValue3
+<<<<<<< generated
+otherPropertyWhichIsModifiedLater = modifiedValueInConflictSourceDir
+=======
+otherPropertyWhichIsModifiedLater = modifiedValueInNormalSourceDir
+>>>>>>> edited
+otherPropertyName4 = propertyValue4
+otherPropertyInsertedInConflictSourceDir = insertedValue2

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source1.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source1.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source1.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source1.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source1.properties
+fromDir = existingTargetStrategyTest.mergeStrategy
+propertyName1 = propertyValue1
+propertyName2 = propertyValue2
+propertyName3 = propertyValue3
+propertyWhichIsModifiedLater = modifiedValueInConflictSourceDir
+propertyName4 = propertyValue4
+propertyInsertedInConflictSourceDir = insertedValue2

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source2.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source2.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source2.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/conflict/source2.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source2.properties
+fromDir = existingTargetStrategyTest.mergeStrategy
+otherPropertyName1 = propertyValue1
+otherPropertyName2 = propertyValue2
+otherPropertyName3 = propertyValue3
+otherPropertyWhichIsModifiedLater = modifiedValueInConflictSourceDir
+otherPropertyName4 = propertyValue4
+otherPropertyInsertedInConflictSourceDir = insertedValue2

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/control.xml?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/control.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/control.xml Tue Oct 25 01:23:02 2011
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<control
+    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"
+    loglevel="debug">
+  <output name="output1" file="output1.txt" existingTargetStrategy="merge">
+    <source xsi:type="fileSource" elements="properties">
+      <include>source1.properties</include>
+    </source>
+    <outlet name="org.apache.torque.generator.velocity.propertiesCopy" />
+  </output>
+  <output name="output2" file="output2.txt" existingTargetStrategy="merge" outputDirKey="outputDirKey2">
+    <source xsi:type="fileSource" elements="properties">
+      <include>source2.properties</include>
+    </source>
+    <outlet name="org.apache.torque.generator.velocity.propertiesCopy" />
+  </output>
+</control>
+  
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/outlets/output.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/outlets/output.xml?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/outlets/output.xml (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/outlets/output.xml Tue Oct 25 01:23:02 2011
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<outlets xmlns="http://db.apache.org/torque/4.0/generator/configuration"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <outlet name="org.apache.torque.generator.velocity.propertiesCopy"
+      xsi:type="velocityOutlet" 
+      path="propertiesCopy.vm">
+    <mergepoint name="properties">
+      <action xsi:type="traverseAllAction" element="entry" 
+          outlet="org.apache.torque.generator.velocity.propertyCopy"/>
+    </mergepoint>
+  </outlet>
+  <outlet name="org.apache.torque.generator.velocity.propertyCopy"
+      xsi:type="velocityOutlet" 
+      path="propertyCopy.vm"/>
+</outlets>
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/source1.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/source1.properties?rev=1188480&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/source1.properties (added)
+++ db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/src/source1.properties Tue Oct 25 01:23:02 2011
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+fileName = source1.properties
+fromDir = existingTargetStrategyTest.mergeStrategy
+propertyName1 = propertyValue1
+propertyWhichWasInsertedLater = insertedValue
+propertyName2 = propertyValue2
+propertyName3 = propertyValue3
+propertyWhichIsModifiedLater = modifiedValueInNormalSourceDir
+propertyName4 = propertyValue4



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