db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r965166 [1/4] - in /db/torque/torque4/trunk/torque-generator: ./ src/main/java/org/apache/torque/generator/configuration/ src/main/java/org/apache/torque/generator/configuration/controller/ src/main/java/org/apache/torque/generator/configur...
Date Sun, 18 Jul 2010 06:10:57 GMT
Author: tfischer
Date: Sun Jul 18 06:10:55 2010
New Revision: 965166

URL: http://svn.apache.org/viewvc?rev=965166&view=rev
Log:
- implemented a second source provider which reads the metadata from jdbc as an input
- re-organized packages in consequence:
  - own package configuration.source
  - new package source.jdbc
  - new package source.stream with classes from source.xml (removed) and source
- renamed sourceFilter to skipDecider as the term filter is too vague
- made the source xml schema type abstract and added two concrete implementations. In consequence, an xsi:type attribute must be added to the control xml file when a source is defined. 

Added:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/SourceConfigurationTags.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactories.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactory.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceTransformerSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/package.html
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/jdbc/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/jdbc/SchemaType.java
      - copied, changed from r944878, db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SchemaType.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/XmlOutlet.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProcessConfiguration.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProvider.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SimpleSourcesImpl.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/TransformerDefinition.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ColumnMetadata.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/ForeignKeyMetadata.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSource.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSourceProvider.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/skipDecider/
      - copied from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/filter/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/skipDecider/SkipDecider.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/filter/SourceFilter.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/skipDecider/StopGenerationDecider.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/filter/StopGenerationSourceFilter.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSource.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/FileSourceProvider.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/PropertiesSourceFormat.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/properties/PropertiesSourceType.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/SourceToXml.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/xml/SourceToXml.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/StreamSourceFormat.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceFormat.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/xml/XmlSourceType.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/XmlSourceSaxHandler.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/xml/XmlSourceSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/stream/package.html
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/properties/package.html
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestSkipDecider.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestTransformer.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestSkipDecider.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestTransformer.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/file/FileTestUtils.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/outlet/java/XmlOutletTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/jdbc/
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/jdbc/JdbcMetadataSourceTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/FileSourceProviderTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/SourceToXmlTest.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/xml/SourceToXmlTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/stream/XmlParserTest.java
      - copied, changed from r944873, db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/xml/XmlParserTest.java
    db/torque/torque4/trunk/torque-generator/src/test/resources/org/apache/torque/generator/source/jdbc/
    db/torque/torque4/trunk/torque-generator/src/test/resources/org/apache/torque/generator/source/jdbc/jdbcMetadataSourceTest.sql
Removed:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/SourceConfigurationTags.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/SourceSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/TransformerSaxHandler.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/FileSource.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/FileSourcesImpl.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SimpleSourcesImpl.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceParser.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceType.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/Sources.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/TransformerDefinition.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/filter/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/properties/
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/skipDecider/SourceFilter.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/skipDecider/StopGenerationSourceFilter.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/xml/
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/xml/
Modified:
    db/torque/torque4/trunk/torque-generator/   (props changed)
    db/torque/torque4/trunk/torque-generator/pom.xml
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/ConfigurationHandlers.java
    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/UnitDescriptor.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/OutputSaxHandler.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/java/org/apache/torque/generator/control/ControllerState.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/file/Fileset.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/Source.java
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceImpl.java
    db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.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/configuration/src/main/torque-gen/conf/options.properties
    db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gen/conf/control.xml
    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/file/FilesetTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/RichSourceElementImplTest.java
    db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/properties/PropertiesParserTest.java
    db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gen/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/resources/org/apache/torque/generator/test/readfromclasspath/conf/control.xml
    db/torque/torque4/trunk/torque-generator/src/test/site/gettingStarted/src/main/torque-gen/conf/control.xml

Propchange: db/torque/torque4/trunk/torque-generator/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jul 18 06:10:55 2010
@@ -2,3 +2,4 @@
 target
 .settings
 .classpath
+.checkstyle

Modified: db/torque/torque4/trunk/torque-generator/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/pom.xml?rev=965166&r1=965165&r2=965166&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/pom.xml (original)
+++ db/torque/torque4/trunk/torque-generator/pom.xml Sun Jul 18 06:10:55 2010
@@ -83,6 +83,18 @@
       <version>1.4</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>10.5.3.0_1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derbyclient</artifactId>
+      <version>10.5.3.0_1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/ConfigurationHandlers.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/ConfigurationHandlers.java?rev=965166&r1=965165&r2=965166&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/ConfigurationHandlers.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/ConfigurationHandlers.java Sun Jul 18 06:10:55 2010
@@ -24,9 +24,10 @@ import java.util.Set;
 
 import org.apache.torque.generator.configuration.mergepoint.ActionSaxHandlerFactories;
 import org.apache.torque.generator.configuration.mergepoint.OptionsSaxHandlerFactories;
-import org.apache.torque.generator.source.SourceType;
-import org.apache.torque.generator.source.properties.PropertiesSourceType;
-import org.apache.torque.generator.source.xml.XmlSourceType;
+import org.apache.torque.generator.configuration.source.SourceSaxHandlerFactories;
+import org.apache.torque.generator.source.stream.PropertiesSourceFormat;
+import org.apache.torque.generator.source.stream.StreamSourceFormat;
+import org.apache.torque.generator.source.stream.XmlSourceFormat;
 
 /**
  * Contains the required handlers for reading the configuration.
@@ -41,35 +42,42 @@ public class ConfigurationHandlers
     private OutletTypes outletTypes = new OutletTypes();
 
     /**
-     * The known types of source types.
+     * The known (file) formats of stream sources (e.g. XML, properties).
      */
-    private Set<SourceType> sourceTypes = new HashSet<SourceType>();
+    private Set<StreamSourceFormat> streamSourceFormats 
+        = new HashSet<StreamSourceFormat>();
 
     /**
-     * The known types of mergepoint action handlers.
+     * The known mergepoint action configuration handlers.
      */
     private ActionSaxHandlerFactories actionSaxHandlerFactories
             = new ActionSaxHandlerFactories();
 
     /**
-     * The known types of options.
+     * The known option configuration handlers.
      */
     private OptionsSaxHandlerFactories optionsSaxHandlerFactories
             = new OptionsSaxHandlerFactories();
 
     /**
+     * The known source configuration handlers.
+     */
+    private SourceSaxHandlerFactories sourceSaxHandlerFactories
+            = new SourceSaxHandlerFactories();
+
+    /**
      * Standard constructor.
      */
     public ConfigurationHandlers()
     {
-        sourceTypes.add(new XmlSourceType());
-        sourceTypes.add(new PropertiesSourceType());
+        streamSourceFormats.add(new XmlSourceFormat());
+        streamSourceFormats.add(new PropertiesSourceFormat());
     }
 
     /**
      * Returns the known outlet types.
      *
-     * @return the known outlet types.
+     * @return the known outlet types, not null.
      */
     public OutletTypes getOutletTypes()
     {
@@ -77,19 +85,29 @@ public class ConfigurationHandlers
     }
 
     /**
-     * Returns the known source types.
+     * Returns the known source configuration handlers.
+     *
+     * @return the known source configuration handlers, not mull.
+     */
+    public SourceSaxHandlerFactories getSourceSaxHandlerFactories()
+    {
+        return sourceSaxHandlerFactories;
+    }
+
+    /**
+     * Returns the known formats of stream (e.g. file) sources.
      *
-     * @return the known source types.
+     * @return the known stream source formats, not null.
      */
-    public Set<SourceType> getSourceTypes()
+    public Set<StreamSourceFormat> getStreamSourceFormats()
     {
-        return sourceTypes;
+        return streamSourceFormats;
     }
 
     /**
      * Returns the known mergepoint action handlers.
      *
-     * @return the known mergepoint action handlers.
+     * @return the known mergepoint action handlers, not null.
      */
     public ActionSaxHandlerFactories getActionSaxHandlerFactories()
     {
@@ -99,7 +117,7 @@ public class ConfigurationHandlers
     /**
      * Returns the known options handlers.
      *
-     * @return the known options handlers.
+     * @return the known options handlers, not null.
      */
     public OptionsSaxHandlerFactories getOptionsSaxHandlerFactories()
     {

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=965166&r1=965165&r2=965166&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 Sun Jul 18 06:10:55 2010
@@ -27,8 +27,8 @@ import java.util.List;
 import org.apache.torque.generator.configuration.controller.Loglevel;
 import org.apache.torque.generator.configuration.controller.Output;
 import org.apache.torque.generator.configuration.outlet.OutletConfiguration;
-import org.apache.torque.generator.file.Fileset;
 import org.apache.torque.generator.option.Options;
+import org.apache.torque.generator.source.SourceProvider;
 
 /**
  * A container for the configuration for a generation unit.
@@ -37,23 +37,19 @@ import org.apache.torque.generator.optio
  */
 public class UnitConfiguration
 {
-    /** The list of all activities of the generation unit. */
-    private List<Output> outputFiles = new ArrayList<Output>();
+    /** The list of all output activities of the generation unit. */
+    private List<Output> outputList = new ArrayList<Output>();
 
-    /**
-     * All options for the generation unit.
-     */
+    /** All options for the generation unit. */
     private Options options;
     
-    /**  Overrides the source files defined in the control file. */  
-    private Fileset overrideSourceFileset;
+    /** Overrides the source provider defined in the control file. */  
+    private SourceProvider overrideSourceProvider;
 
-    /**  Whether the overrideSourceFileset was initialized. */  
-    private boolean overrideSourceFilesetInitialized = false;
+    /** Whether the overrideSourceProviderInitialized was initialized. */  
+    private boolean overrideSourceProviderInitialized = false;
 
-    /**
-     * The configuration for the available outlets.
-     */
+    /** The configuration for the available outlets. */
     private OutletConfiguration outletConfiguration;
 
     /**
@@ -215,37 +211,38 @@ public class UnitConfiguration
     }
 
     /**
-     * Sets the output files of the associated configuration unit.
+     * Sets the output activities of the associated configuration unit.
      *
-     * @param outputFiles the output files, not null.
+     * @param outputList the output activities, not null.
      *
      * @throws NullPointerException if outputFiles is null.
      */
-    public void setOutputFiles(List<Output> outputFiles)
+    public void setOutputList(List<Output> outputList)
     {
-        if (outputFiles == null)
+        if (outputList == null)
         {
             throw new NullPointerException(
-                    "outputFiles cannot be null");
+                    "outputList cannot be null");
         }
-        this.outputFiles = outputFiles;
+        this.outputList = outputList;
     }
 
     /**
-     * Returns the output files of the associated configuration unit.
+     * Returns the list of output definitions of the associated configuration
+     * unit.
      *
-     * @return the output files, not null.
+     * @return the output definitions, not null.
      *
-     * @throws IllegalStateException if the output files were not yet set.
+     * @throws IllegalStateException if the output definitions were not yet set.
      */
-    public List<Output> getOutputFiles()
+    public List<Output> getOutputList()
     {
-        if (outputFiles == null)
+        if (outputList == null)
         {
             throw new IllegalStateException(
                     "outputFiles are not initialized");
         }
-        return Collections.unmodifiableList(outputFiles);
+        return Collections.unmodifiableList(outputList);
     }
 
     /**
@@ -282,35 +279,36 @@ public class UnitConfiguration
     }
 
     /**
-     * Returns the fileset which overrides the source files defined
+     * Returns the source provider which overrides the source provider defined
      * in the control file.
      *
-     * @return the fileset, or null to use the fileset defined in the
-     *         control file.
+     * @return the overriding source provider, or null to use the 
+     *         source provider defined in the control file.
      *
      * @throws NullPointerException if overrideSourceFileset was not yet set.
      */
-    public Fileset getOverrideSourceFileset()
+    public SourceProvider getOverrideSourceProvider()
     {
-        if (!overrideSourceFilesetInitialized)
+        if (!overrideSourceProviderInitialized)
         {
             throw new IllegalStateException(
-                    "overrideSourceFileset is not initialized");
+                    "overrideSourceProvider is not initialized");
         }
-        return overrideSourceFileset;
+        return overrideSourceProvider;
     }
 
     /**
-     * Sets the fileset which overrides the source files defined
+     * Sets the source provider which overrides the source provider defined
      * in the control file.
      *
-     * @param overrideSourceFileset the override fileset, or null
-     *        to use the fileset defined in the control file.
+     * @param overrideSourceProvider the override source provider, or null
+     *        to use the source provider defined in the control file.
      */
-    public void setOverrideSourceFileset(Fileset overrideSourceFileset)
+    public void setOverrideSourceProvider(
+            SourceProvider overrideSourceProvider)
     {
-        this.overrideSourceFileset = overrideSourceFileset;
-        overrideSourceFilesetInitialized = true;
+        this.overrideSourceProvider = overrideSourceProvider;
+        overrideSourceProviderInitialized = true;
     }
 
     /**
@@ -321,13 +319,13 @@ public class UnitConfiguration
      */
     public boolean isInit()
     {
-        if (outputFiles == null
+        if (outputList == null
             || options == null
             || outletConfiguration == null
             || newFileTargetDirectory == null
             || modifiedFileTargetDirectory == null
             || loglevel == null
-            || !overrideSourceFilesetInitialized)
+            || !overrideSourceProviderInitialized)
         {
             return false;
         }
@@ -339,7 +337,7 @@ public class UnitConfiguration
     {
         StringBuffer result = new StringBuffer();
         result.append("(outputFiles=")
-                .append(outputFiles.toString())
+                .append(outputList.toString())
                 .append(", options=")
                 .append(options)
                 .append(", outletConfiguration=")

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=965166&r1=965165&r2=965166&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 Sun Jul 18 06:10:55 2010
@@ -90,8 +90,8 @@ class UnitConfigurationReader
                 unitDescriptor.getProjectPaths().getNewFileTargetPath());
         unitConfiguration.setModifiedFileTargetDirectory(
                 unitDescriptor.getProjectPaths().getModifiedFileTargetPath());
-        unitConfiguration.setOverrideSourceFileset(
-                unitDescriptor.getOverrideSourceFileset());
+        unitConfiguration.setOverrideSourceProvider(
+                unitDescriptor.getOverrideSourceProvider());
 
         ConfigurationProvider configurationProvider
             = createConfigurationProvider(unitDescriptor);
@@ -161,12 +161,12 @@ class UnitConfigurationReader
         List<Output> outputFiles = new ArrayList<Output>();
         // inherited Files are generated first.
         Set<QualifiedName> qualifiedNames = new HashSet<QualifiedName>();
-        for (Output output : inheritedConfiguration.getOutputFiles())
+        for (Output output : inheritedConfiguration.getOutputList())
         {
             outputFiles.add(output);
             qualifiedNames.add(output.getName());
         }
-        for (Output output : unitConfiguration.getOutputFiles())
+        for (Output output : unitConfiguration.getOutputList())
         {
             if (qualifiedNames.contains(output.getName()))
             {
@@ -177,14 +177,14 @@ class UnitConfigurationReader
                     {
                         addedOutputIt.remove();
                         log.info("Output with name " + output.getName()
-                                + " is overriden in child and is replaced.");
+                                + " is overridden in child and is replaced.");
                         break;
                     }
                 }
             }
             outputFiles.add(output);
         }
-        unitConfiguration.setOutputFiles(outputFiles);
+        unitConfiguration.setOutputList(outputFiles);
     }
 
     /**
@@ -284,7 +284,7 @@ class UnitConfigurationReader
             unitConfiguration.setLoglevel(controlConfiguration.getLoglevel());
             controlConfiguration.getLoglevel().apply();
         }
-        unitConfiguration.setOutputFiles(
+        unitConfiguration.setOutputList(
                 controlConfiguration.getOutputFiles());
 
         {

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitDescriptor.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitDescriptor.java?rev=965166&r1=965165&r2=965166&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitDescriptor.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/UnitDescriptor.java Sun Jul 18 06:10:55 2010
@@ -23,7 +23,7 @@ import org.apache.torque.generator.confi
 import org.apache.torque.generator.configuration.option.OptionsConfiguration;
 import org.apache.torque.generator.configuration.paths.ProjectPaths;
 import org.apache.torque.generator.configuration.paths.TorqueGeneratorPaths;
-import org.apache.torque.generator.file.Fileset;
+import org.apache.torque.generator.source.SourceProvider;
 
 /**
  * Contains all necessary information about a generation unit.
@@ -63,8 +63,8 @@ public class UnitDescriptor
      */
     private UnitDescriptor inheritsFrom;
 
-    /**  Overrides the source files defined in the templates control file. */  
-    private Fileset overrideSourceFileset;
+    /**  Overrides the source defined in the control file. */  
+    private SourceProvider overrideSourceProvider;
     
     /** Options to override the settings in the project Directory. */
     private OptionsConfiguration overrideOptions;
@@ -109,11 +109,10 @@ public class UnitDescriptor
      *        of the configuration unit, not null.
      * @param inheritsFrom the parent of this generation unit,
      *        or null if it does not inherit from a generation unit.
-     * @param overrideSourceFileset a fileset which overrides the
-     *        source files defined in the templates control file.
+     * @param overrideSourceProvider overrides the source defined in the
+     *        control file.
      * @param overrideOptions Options to override the settings in the project
      *        Directory, or null if no options are overridden.
-     *        
      * @param loglevel The loglevel to override the log level, or null to use
      *        the log level defined in the configuration.
      */
@@ -122,7 +121,7 @@ public class UnitDescriptor
             ProjectPaths projectPaths,
             TorqueGeneratorPaths configurationPaths,
             UnitDescriptor inheritsFrom,
-            Fileset overrideSourceFileset,
+            SourceProvider overrideSourceProvider,
             OptionsConfiguration overrideOptions,
             Loglevel loglevel)
     {
@@ -145,7 +144,7 @@ public class UnitDescriptor
         this.projectPaths = projectPaths;
         this.configurationPaths = configurationPaths;
         this.inheritsFrom = inheritsFrom;
-        this.overrideSourceFileset = overrideSourceFileset;
+        this.overrideSourceProvider = overrideSourceProvider;
         this.overrideOptions = overrideOptions;
         this.loglevel = loglevel;
     }
@@ -194,15 +193,15 @@ public class UnitDescriptor
     }
 
     /**
-     * Returns the fileset overriding the source files defined in the
-     * templates control file, or null if the template control definition
+     * Returns the source provider overriding the source defined in the
+     * control file, or null if the control file definition
      * is not overridden.
      *
-     * @return the configuration of the overriding options, or null.
+     * @return the overriding source provider, or null.
      */
-    public Fileset getOverrideSourceFileset()
+    public SourceProvider getOverrideSourceProvider()
     {
-        return overrideSourceFileset;
+        return overrideSourceProvider;
     }
 
     /**

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=965166&r1=965165&r2=965166&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 Sun Jul 18 06:10:55 2010
@@ -21,7 +21,8 @@ package org.apache.torque.generator.conf
 
 import org.apache.torque.generator.outlet.Outlet;
 import org.apache.torque.generator.qname.QualifiedName;
-import org.apache.torque.generator.source.Sources;
+import org.apache.torque.generator.source.SourceProcessConfiguration;
+import org.apache.torque.generator.source.SourceProvider;
 
 /**
  * The configuration for an output (typically one or more files).
@@ -34,9 +35,14 @@ public class Output
     private QualifiedName name;
 
     /**
-     * The sources to be used as input.
+     * The source provider to access the input for generation.
      */
-    private Sources sources;
+    private SourceProvider sourceProvider;
+
+    /**
+     * The information on how to post-process the sources before generation.
+     */
+    private SourceProcessConfiguration sourceProcessConfiguration;
 
     /**
      * The outlet which generates the content.
@@ -83,25 +89,48 @@ public class Output
     }
 
     /**
-     * Returns the sources which should be used as input for generating the
+     * Returns the source provider which provides the input for generating the
      * output file's contents.
      *
-     * @return the sources which should be used as input for generation.
+     * @return the source provider which provides the input for generation.
      */
-    public Sources getSources()
+    public SourceProvider getSourceProvider()
     {
-        return sources;
+        return sourceProvider;
     }
 
     /**
-     * Sets the sources which should be used as input for generating the
+     * Sets the source provider which provides the input for generating the
      * output file's contents.
      *
-     * @param sources the sources which should be used as input for generation.
+     * @param sourceProvider the source provider which provides the input for
+     *        generation.
+     */
+    public void setSourceProvider(SourceProvider sourceProvider)
+    {
+        this.sourceProvider = sourceProvider;
+    }
+
+    /**
+     * Returns how the sources should be post-processed before generation.
+     *
+     * @return the information about post-processing the sources.
+     */
+    public SourceProcessConfiguration getSourceProcessConfiguration()
+    {
+        return sourceProcessConfiguration;
+    }
+
+    /**
+     * Sets how the sources should be post-processed before generation.
+     *
+     * @param sourceProcessConfiguration the information about
+     *      post-processing the sources.
      */
-    public void setSources(Sources sources)
+    public void setSourceProcessConfiguration(
+            SourceProcessConfiguration sourceProcessConfiguration)
     {
-        this.sources = sources;
+        this.sourceProcessConfiguration = sourceProcessConfiguration;
     }
 
     /**
@@ -215,7 +244,7 @@ public class Output
     public String toString()
     {
         StringBuffer result = new StringBuffer();
-        result.append("(OutputFile: sources=").append(sources)
+        result.append("(OutputFile: sourceProvider=").append(sourceProvider)
                 .append(",skipIfExists=").append(skipIfExists)
                 .append(",filenameOutlet=")
                 .append(filenameOutlet)

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=965166&r1=965165&r2=965166&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 Sun Jul 18 06:10:55 2010
@@ -25,14 +25,18 @@ import static org.apache.torque.generato
 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.SourceConfigurationTags.SOURCE_TAG;
 import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.INPUT_TAG;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SOURCE_TAG;
 
 import org.apache.torque.generator.configuration.ConfigurationHandlers;
 import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.XMLConstants;
 import org.apache.torque.generator.configuration.outlet.OutletConfigurationSaxHandler;
 import org.apache.torque.generator.configuration.outlet.OutletSaxHandler;
 import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.configuration.source.SourceSaxHandler;
+import org.apache.torque.generator.configuration.source.SourceSaxHandlerFactories;
+import org.apache.torque.generator.configuration.source.SourceSaxHandlerFactory;
 import org.apache.torque.generator.qname.QualifiedName;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
@@ -185,7 +189,21 @@ public class OutputSaxHandler extends De
         }
         else if (SOURCE_TAG.equals(rawName))
         {
-            sourceSaxHandler = new SourceSaxHandler(
+            String type = attributes.getValue(
+                    XMLConstants.XSI_NAMESPACE,
+                    XMLConstants.XSI_TYPE_ATTRBUTE_NAME);
+            SourceSaxHandlerFactories sourceSaxHandlerFactories
+                = configurationHandlers.getSourceSaxHandlerFactories();
+            SourceSaxHandlerFactory sourceSaxHandlerFactory
+                 = sourceSaxHandlerFactories.getSourceSaxHandlerFactory(type);
+            if (sourceSaxHandlerFactory == null)
+            {
+                throw new SAXException("Unknown source type "
+                        + type
+                        + ". Known source types are "
+                        + sourceSaxHandlerFactories.getSourceTypes());
+            }
+            sourceSaxHandler = sourceSaxHandlerFactory.getSourceSaxHandler(
                     configurationProvider,
                     projectPaths,
                     configurationHandlers);
@@ -253,7 +271,10 @@ public class OutputSaxHandler extends De
             sourceSaxHandler.endElement(uri, localName, rawName);
             if (sourceSaxHandler.isFinished())
             {
-                output.setSources(sourceSaxHandler.getSources());
+                output.setSourceProvider(
+                        sourceSaxHandler.getSourceProvider());
+                output.setSourceProcessConfiguration(
+                        sourceSaxHandler.getSourceProcessConfiguration());
                 sourceSaxHandler = null;
             }
         }

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandler.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandler.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandler.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,219 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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 static org.apache.torque.generator.configuration.source.SourceConfigurationTags.EXCLUDE_TAG;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.FORMAT_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.INCLUDE_TAG;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SOURCE_TAG;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.torque.generator.configuration.ConfigurationException;
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.file.Fileset;
+import org.apache.torque.generator.source.SourceProvider;
+import org.apache.torque.generator.source.stream.FileSourceProvider;
+import org.apache.torque.generator.source.stream.StreamSourceFormat;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reads file source definitions from the controller configuration file.
+ */
+public class FileSourceSaxHandler extends SourceSaxHandler
+{
+    /** The file format of the source element which is currently parsed. */
+    private String format;
+
+    /** The source file names which should be included in generation. */
+    private Set<String> includes = new HashSet<String>();
+
+    /** The source file names which should be excluded from generation. */
+    private Set<String> excludes = new HashSet<String>();
+
+    /**
+     * The string builder for an include definition.
+     * Not null if an include tag is currently parsed.
+     */
+    private StringBuilder currentInclude = null;
+
+    /**
+     * The string builder for an exclude definition.
+     * Not null if an exclude tag is currently parsed.
+     */
+    private StringBuilder currentExclude = null;
+
+    /**
+     * The source provider which is configured by this SAX handler.
+     */
+    private SourceProvider sourceProvider;
+
+    /**
+     * Constructor.
+     *
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers All known configuration handlers, not null.
+     *
+     * @throws NullPointerException if an argument is null.
+     */
+    public FileSourceSaxHandler(
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+    {
+        super(configurationProvider, projectPaths, configurationHandlers);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void startElement(String uri, String localName, String rawName,
+                             Attributes attributes)
+            throws SAXException
+    {
+        if (rawName.equals(INCLUDE_TAG))
+        {
+            currentInclude = new StringBuilder();
+        }
+        else if (rawName.equals(EXCLUDE_TAG))
+        {
+            currentExclude = new StringBuilder();
+        }
+        else if (rawName.equals(SOURCE_TAG))
+        {
+            super.startElement(uri, localName, rawName, attributes);
+            format = attributes.getValue(FORMAT_ATTRIBUTE);
+        }
+        else
+        {
+            super.startElement(uri, localName, rawName, attributes);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void endElement(String uri, String localName, String rawName)
+        throws SAXException
+    {
+        if (rawName.equals(INCLUDE_TAG))
+        {
+            includes.add(currentInclude.toString());
+            currentInclude = null;
+        }
+        else if (rawName.equals(EXCLUDE_TAG))
+        {
+            excludes.add(currentExclude.toString());
+            currentExclude = null;
+        }
+        else if (rawName.equals(SOURCE_TAG))
+        {
+            try
+            {
+                StreamSourceFormat sourceFormat = null;
+                if (format != null)
+                {
+                    Set<StreamSourceFormat> sourceFormats
+                        = getConfigurationHandlers().getStreamSourceFormats();
+                    for (StreamSourceFormat candidate : sourceFormats)
+                    {
+                        if (format.equals(candidate.getKey()))
+                        {
+                            sourceFormat = candidate;
+                            break;
+                        }
+                    }
+                    if (sourceFormat == null)
+                    {
+                        throw new SAXException("Unknown source format : "
+                                + format
+                                + " Known types are: " + sourceFormat);
+                    }
+                }
+                Fileset sourceFileset = new Fileset(
+                        getProjectPaths().getDefaultSourcePath(),
+                        includes,
+                        excludes);
+
+                sourceProvider = new FileSourceProvider(
+                        sourceFormat,
+                        sourceFileset);
+            }
+            catch (ConfigurationException e)
+            {
+                throw new SAXException("Could not create source: "
+                            + e.getMessage(),
+                        e);
+            }
+            super.endElement(uri, localName, rawName);
+            finished();
+        }
+        else
+        {
+            super.endElement(uri, localName, rawName);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void characters(char[] ch, int start, int length)
+            throws SAXException
+    {
+        if (currentInclude != null)
+        {
+            for (int i = start; i < start + length; ++i)
+            {
+                currentInclude.append(ch[i]);
+            }
+        }
+        else if (currentExclude != null)
+        {
+            for (int i = start; i < start + length; ++i)
+            {
+                currentExclude.append(ch[i]);
+            }
+        }
+        else
+        {
+            super.characters(ch, start, length);
+        }
+    }
+
+    /**
+     * Returns the configuration filled with the contents of the parsed snippet.
+     *
+     * @return the configuration which was filled, not null if a
+     *         matching snippet was processed.
+     */
+    public SourceProvider getSourceProvider()
+    {
+        return sourceProvider;
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandlerFactory.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandlerFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/FileSourceSaxHandlerFactory.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,70 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+
+/**
+ * A Factory which creates a SAX handler for file sources.
+ *
+ * @version $Id: $
+ */
+public class FileSourceSaxHandlerFactory
+        implements SourceSaxHandlerFactory
+{
+    /** The type of the source. */
+    private static final String TYPE = "fileSource";
+
+
+    /**
+     * Returns the source type which can be handled by the
+     * FileSourceSaxHandlers created by this factory.
+     *
+     * @return "fileSource".
+     */
+    public String getType()
+    {
+        return TYPE;
+    }
+
+    /**
+     * Returns a FileSourceSaxHandlers for reading the configuration of
+     * file sources.
+     *
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers All known configuration handlers, not null.
+     *
+     * @return a new FileSourcesSaxHandlers.
+     */
+    public final SourceSaxHandler getSourceSaxHandler(
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+    {
+        return new FileSourceSaxHandler(
+                configurationProvider,
+                projectPaths,
+                configurationHandlers);
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandler.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandler.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandler.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,130 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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 static org.apache.torque.generator.configuration.source.SourceConfigurationTags.DRIVER_OPTION_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.PASSWORD_OPTION_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SCHEMA_OPTION_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SOURCE_TAG;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.URL_OPTION_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.USERNAME_OPTION_ATTRIBUTE;
+
+import org.apache.torque.generator.configuration.ConfigurationException;
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.source.SourceProvider;
+import org.apache.torque.generator.source.jdbc.JdbcMetadataSourceProvider;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reads jdbc metadata source definitions from the controller configuration
+ * file.
+ */
+public class JdbcMetadataSourceSaxHandler extends SourceSaxHandler
+{
+    /**
+     * The source provider which is configured by this SAX handler.
+     */
+    private SourceProvider sourceProvider;
+
+    /**
+     * Constructor.
+     *
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers All known configuration handlers, not null.
+     *
+     * @throws NullPointerException if an argument is null.
+     */
+    public JdbcMetadataSourceSaxHandler(
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+    {
+        super(configurationProvider, projectPaths, configurationHandlers);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void startElement(String uri, String localName, String rawName,
+                             Attributes attributes)
+            throws SAXException
+    {
+        if (rawName.equals(SOURCE_TAG))
+        {
+            String urlOption
+                    = attributes.getValue(URL_OPTION_ATTRIBUTE);
+            String driverOption
+                    = attributes.getValue(DRIVER_OPTION_ATTRIBUTE);
+            String usernameOption
+                    = attributes.getValue(USERNAME_OPTION_ATTRIBUTE);
+            String passwordOption
+                    = attributes.getValue(PASSWORD_OPTION_ATTRIBUTE);
+            String schemaOption
+                    = attributes.getValue(SCHEMA_OPTION_ATTRIBUTE);
+            try
+            {
+                sourceProvider = new JdbcMetadataSourceProvider(
+                        urlOption,
+                        driverOption,
+                        usernameOption,
+                        passwordOption,
+                        schemaOption);
+            }
+            catch (ConfigurationException e)
+            {
+                throw new SAXException(
+                        "Could not parse Source Tag: " + e.getMessage(),
+                        e);
+            }
+        }
+        super.startElement(uri, localName, rawName, attributes);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void endElement(String uri, String localName, String rawName)
+        throws SAXException
+    {
+        super.endElement(uri, localName, rawName);
+        if (rawName.equals(SOURCE_TAG))
+        {
+            finished();
+        }
+    }
+
+    /**
+     * Returns the configuration filled with the contents of the parsed snippet.
+     *
+     * @return the configuration which was filled, not null if a
+     *         matching snippet was processed.
+     */
+    public SourceProvider getSourceProvider()
+    {
+        return sourceProvider;
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandlerFactory.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandlerFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/JdbcMetadataSourceSaxHandlerFactory.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,70 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+
+/**
+ * A Factory which creates a SAX handler for sources from JDBC Metadata.
+ *
+ * @version $Id: $
+ */
+public class JdbcMetadataSourceSaxHandlerFactory
+        implements SourceSaxHandlerFactory
+{
+    /** The type of the source. */
+    private static final String TYPE = "jdbcMetadataSource";
+
+
+    /**
+     * Returns the source type which can be handled by the
+     * JdbcMetadataSourceSaxHandler created by this factory.
+     *
+     * @return "jdbcMetadataSource".
+     */
+    public String getType()
+    {
+        return TYPE;
+    }
+
+    /**
+     * Returns a JdbcMetadataSourceSaxHandler for reading the configuration of
+     * JDBC metadata sources.
+     *
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers All known configuration handlers, not null.
+     *
+     * @return a new FileSourcesSaxHandlers.
+     */
+    public final SourceSaxHandler getSourceSaxHandler(
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+    {
+        return new JdbcMetadataSourceSaxHandler(
+                configurationProvider,
+                projectPaths,
+                configurationHandlers);
+    }
+}

Copied: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java (from r944873, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/SourceConfigurationTags.java)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java?p2=db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java&p1=db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/SourceConfigurationTags.java&r1=944873&r2=965166&rev=965166&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/controller/SourceConfigurationTags.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java Sun Jul 18 06:10:55 2010
@@ -1,4 +1,4 @@
-package org.apache.torque.generator.configuration.controller;
+package org.apache.torque.generator.configuration.source;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -34,14 +34,14 @@ public final class SourceConfigurationTa
     /** Tag name for the "source" tag. */
     public static final String SOURCE_TAG = "source";
 
-    /** Attribute name for the "type" attribute. */
-    public static final String TYPE_ATTRIBUTE = "type";
-
     /** Attribute name for the "elements" attribute. */
     public static final String ELEMENTS_ATTRIBUTE = "elements";
 
-    /** Attribute name for the "sourceFilter" attribute. */
-    public static final String SOURCE_FILTER_ATTRIBUTE = "filter";
+    /** Attribute name for the "skipDecider" attribute. */
+    public static final String SKIP_DECIDER_ARRTIBUTE = "skipDecider";
+
+    /** Attribute name for the "format" attribute. */
+    public static final String FORMAT_ATTRIBUTE = "format";
 
     /** Tag name for the "transformer" tag. */
     public static final String TRANSFORMER_TAG = "transformer";
@@ -55,4 +55,18 @@ public final class SourceConfigurationTa
     /** Tag name for the "transformer" tag. */
     public static final String EXCLUDE_TAG = "exclude";
 
+    /** Attribute name for the "urlOption" attribute. */
+    public static final String URL_OPTION_ATTRIBUTE = "urlOption";
+
+    /** Attribute name for the "driverOption" attribute. */
+    public static final String DRIVER_OPTION_ATTRIBUTE = "driverOption";
+
+    /** Attribute name for the "usernameOption" attribute. */
+    public static final String USERNAME_OPTION_ATTRIBUTE = "usernameOption";
+
+    /** Attribute name for the "passwordOption" attribute. */
+    public static final String PASSWORD_OPTION_ATTRIBUTE = "passwordOption";
+
+    /** Attribute name for the "schemaOption" attribute. */
+    public static final String SCHEMA_OPTION_ATTRIBUTE = "schemaOption";
 }

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,260 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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 static org.apache.torque.generator.configuration.source.SourceConfigurationTags.ELEMENTS_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SKIP_DECIDER_ARRTIBUTE;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SOURCE_TAG;
+import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.TRANSFORMER_TAG;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.torque.generator.configuration.ConfigurationException;
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.apache.torque.generator.source.SourceProcessConfiguration;
+import org.apache.torque.generator.source.SourceProvider;
+import org.apache.torque.generator.source.SourceTransformerDefinition;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A base class for reading source definitions from the controller
+ * configuration file.
+ */
+public abstract class SourceSaxHandler extends DefaultHandler
+{
+    /** The access object for the configuration files, not null. */
+    private ConfigurationProvider configurationProvider;
+
+    /** The paths of the surrounding project, not null. */
+    private ProjectPaths projectPaths;
+
+    /** The known configuration handlers. */
+    private ConfigurationHandlers configurationHandlers;
+
+    /** The source process configuration. */
+    private SourceProcessConfiguration sourceProcessConfiguration;
+
+    /**
+     * The transformer definitions in the source element.
+     */
+    private List<SourceTransformerDefinition> transformerDefinitions
+            = new ArrayList<SourceTransformerDefinition>();
+
+    /** The handler which handles transformer elements. */
+    private SourceTransformerSaxHandler transformerSaxHandler;
+
+    /** Whether this handler has completed its task. */
+    private boolean finished = false;
+
+    /**
+     * Constructor.
+     *
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers All known configuration handlers, not null.
+     *
+     * @throws NullPointerException if an argument is null.
+     */
+    public SourceSaxHandler(
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+    {
+        if (configurationProvider == null)
+        {
+            throw new NullPointerException(
+                    "configurationProvider must not be null");
+        }
+        if (projectPaths == null)
+        {
+            throw new NullPointerException(
+                    "projectPaths must not be null");
+        }
+        if (configurationHandlers == null)
+        {
+            throw new NullPointerException(
+                    "configurationHandlers must not be null");
+        }
+        this.configurationProvider = configurationProvider;
+        this.projectPaths = projectPaths;
+        this.configurationHandlers = configurationHandlers;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void startElement(String uri, String localName, String rawName,
+                             Attributes attributes)
+            throws SAXException
+    {
+        if (transformerSaxHandler != null)
+        {
+            transformerSaxHandler.startElement(
+                    uri, localName, rawName, attributes);
+        }
+        else if (TRANSFORMER_TAG.equals(rawName))
+        {
+            transformerSaxHandler
+                    = new SourceTransformerSaxHandler(
+                            configurationProvider, projectPaths);
+            transformerSaxHandler.startElement(
+                    uri, localName, rawName, attributes);
+        }
+        else if (rawName.equals(SOURCE_TAG))
+        {
+            sourceProcessConfiguration = new SourceProcessConfiguration();
+            sourceProcessConfiguration.setStartElementsPath(
+                    attributes.getValue(ELEMENTS_ATTRIBUTE));
+            try
+            {
+                sourceProcessConfiguration.setSkipDecider(
+                        attributes.getValue(SKIP_DECIDER_ARRTIBUTE));
+            }
+            catch (ConfigurationException e)
+            {
+                throw new SAXException("Could not create source: "
+                            + e.getMessage(),
+                        e);
+            }
+        }
+        else
+        {
+            throw new SAXException("Unknown element " + rawName);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void endElement(String uri, String localName, String rawName)
+        throws SAXException
+    {
+        if (transformerSaxHandler != null)
+        {
+            transformerSaxHandler.endElement(
+                    uri,
+                    localName,
+                    rawName);
+            if (transformerSaxHandler.isFinished())
+            {
+                transformerDefinitions.add(new SourceTransformerDefinition(
+                        transformerSaxHandler.getSourceTransformer(),
+                        transformerSaxHandler.getElements()));
+                transformerSaxHandler = null;
+            }
+        }
+        else if (rawName.equals(SOURCE_TAG))
+        {
+            sourceProcessConfiguration.setSourceTransformerDefinitions(
+                    transformerDefinitions);
+            transformerDefinitions
+                    = new ArrayList<SourceTransformerDefinition>();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void characters(char[] ch, int start, int length)
+            throws SAXException
+    {
+        if (transformerSaxHandler != null)
+        {
+            transformerSaxHandler.characters(ch, start, length);
+        }
+    }
+
+    /**
+     * Returns the configurationProvider to access the configuration.
+     *
+     * @return the configurationProvider to access the configuration, not null.
+     */
+    public ConfigurationProvider getConfigurationProvider()
+    {
+        return configurationProvider;
+    }
+
+    /**
+     * Returns the known configuration handlers.
+     *
+     * @return the configuration handlers, not null.
+     */
+    public ConfigurationHandlers getConfigurationHandlers()
+    {
+        return configurationHandlers;
+    }
+
+    /**
+     * Returns the paths of the surrounding project.
+     *
+     * @return the paths of the surrounding project, not null.
+     */
+    public ProjectPaths getProjectPaths()
+    {
+        return projectPaths;
+    }
+
+    /**
+     * Returns whether the matching snippet was completely parsed.
+     *
+     * @return true if the matching snippet was completely parsed,
+     *         false otherwise.
+     */
+    public boolean isFinished()
+    {
+        return finished;
+    }
+
+    /**
+     * Marks that the matching snippet was completely parsed.
+     */
+    protected void finished()
+    {
+        finished = true;
+    }
+
+    /**
+     * Returns the information how to read the sources.
+     *
+     * @return the source Provider, not null if the
+     *         source snippet was processed.
+     */
+    public abstract SourceProvider getSourceProvider();
+
+    /**
+     * Returns the information how to post-process the sources.
+     *
+     * @return the sourceProcessConfiguration, not null if the
+     *         source snippet was processed.
+     */
+    public SourceProcessConfiguration getSourceProcessConfiguration()
+    {
+        return sourceProcessConfiguration;
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactories.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactories.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactories.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactories.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,118 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.generator.configuration.ConfigurationException;
+
+/**
+ * A registry of SourceSaxHandlerFactories.
+ *
+ * $Id: $
+ */
+public class SourceSaxHandlerFactories
+{
+    /** The class log. */
+    private static Log log
+            = LogFactory.getLog(SourceSaxHandlerFactories.class);
+
+    /**
+     * A map containing all known SourceSaxHandlerFactories,
+     * keyed by the type of the sources.
+     */
+    private Map<String, SourceSaxHandlerFactory> factories
+            = new HashMap<String, SourceSaxHandlerFactory>();
+
+    /**
+     * Constructor. Registers the default SourceSaxHandlerFactories.
+     */
+    public SourceSaxHandlerFactories()
+    {
+        try
+        {
+            register(new FileSourceSaxHandlerFactory());
+            register(new JdbcMetadataSourceSaxHandlerFactory());
+        }
+        catch (ConfigurationException e)
+        {
+            // should not happen
+            log.error("caught ConfigurationException while registering "
+                    + "the default Source Sax Handler Factories", e);
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Registers a new SourcseSaxHandlerFactory.
+     *
+     * @param sourceSaxHandlerFactory the factory to register, not null.
+     *
+     * @throws ConfigurationException if the type of the registered factory
+     *         already exists.
+     */
+    public void register(SourceSaxHandlerFactory sourceSaxHandlerFactory)
+        throws ConfigurationException
+    {
+        String type = sourceSaxHandlerFactory.getType();
+
+        SourceSaxHandlerFactory oldFactory = factories.get(type);
+        if (oldFactory != null)
+        {
+            throw new ConfigurationException(
+                    "Attempted to register an SourceSaxHandlerFactory "
+                        + "of type "
+                        + sourceSaxHandlerFactory.getType()
+                        + " and class "
+                        + sourceSaxHandlerFactory.getClass().getName()
+                        + " : A factory with this type already exists, "
+                        + " it has the class "
+                        + oldFactory.getClass().getName());
+        }
+        factories.put(type, sourceSaxHandlerFactory);
+    }
+
+    /**
+     * Returns the SourceSaxHandlerFactory associated with the given type.
+     *
+     * @param type the type top look for, not null.
+     *
+     * @return the SourceSaxHandlerFactory associated with the given type,
+     *         or null if no SourceSaxHandlerFactory exists for the given type.
+     */
+    public SourceSaxHandlerFactory getSourceSaxHandlerFactory(String type)
+    {
+        return factories.get(type);
+    }
+
+    /**
+     * Returns the known source types.
+     *
+     * @return the known source types, not null.
+     */
+    public Set<String> getSourceTypes()
+    {
+        return factories.keySet();
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactory.java?rev=965166&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandlerFactory.java Sun Jul 18 06:10:55 2010
@@ -0,0 +1,64 @@
+package org.apache.torque.generator.configuration.source;
+
+/*
+ * 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.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.ConfigurationProvider;
+import org.apache.torque.generator.configuration.paths.ProjectPaths;
+import org.xml.sax.SAXException;
+
+/**
+ * Classes implementing this interface are responsible for creating
+ * <code>SourceSaxHandler</code>s for a specific source type.
+ */
+public abstract interface SourceSaxHandlerFactory
+{
+    /**
+     * Returns the source type handled by the SourceSaxHandlers which are
+     * created by this factory.
+     *
+     * @return the type of the sources, not null.
+     */
+    String getType();
+
+    /**
+     * Returns a SourceSaxHandler for reading the configuration of
+     * sources. The SAX Handler is used as a delegate handler
+     * whenever a source element with the matching type
+     * is encountered in a configuration file.
+     *
+     * @param configurationProvider The access object for the configuration
+     *        files, not null.
+     * @param projectPaths The paths of the surrounding project, not null.
+     * @param configurationHandlers the available configuration handlers,
+     *        not null.
+     *
+     * @return a SAX delegate handler for parsing the configuration with the
+     *         given type.
+     *
+     * @throws SAXException if the SAX Handler for the sources can
+     *         not be created from the given XML element.
+     */
+    SourceSaxHandler getSourceSaxHandler(
+            ConfigurationProvider configurationProvider,
+            ProjectPaths projectPaths,
+            ConfigurationHandlers configurationHandlers)
+        throws SAXException;
+}



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