db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r591757 - in /db/torque: maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/ site/trunk/xdocs/
Date Sun, 04 Nov 2007 10:53:09 GMT
Author: tfischer
Date: Sun Nov  4 02:53:08 2007
New Revision: 591757

URL: http://svn.apache.org/viewvc?rev=591757&view=rev
Log:
Changed the default value of the parameter "suffix" in the id-table-init-sql goal "-idtable-init"
(was: "").

Added:
    db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojoBase.java
Modified:
    db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java
    db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java
    db/torque/site/trunk/xdocs/changes.xml

Modified: db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java
URL: http://svn.apache.org/viewvc/db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java?rev=591757&r1=591756&r2=591757&view=diff
==============================================================================
--- db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java
(original)
+++ db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java
Sun Nov  4 02:53:08 2007
@@ -31,7 +31,7 @@
  * @goal id-table-init-sql
  * @phase generate-sources
  */
-public class IdTableInitSqlMojo extends SqlMojo
+public class IdTableInitSqlMojo extends SqlMojoBase
 {
     public static final String INITIALID_CONTEXT_PROPERTY
             = "initialID";
@@ -42,7 +42,15 @@
 
     // The following dummies trick the Mojo Description Extractor
     // into setting the correct default values for
-    // reportFile and contextPropertiesPath
+    // outputDir, reportFile, contextPropertiesPath and suffix
+    /**
+     * The directory in which the SQL will be generated.
+     *
+     * @parameter property="outputDir"
+     *            expression="${project.build.directory}/generated-sql/torque"
+     */
+    private String dummy;
+
     /**
      * The location where the report file will be generated.
      *
@@ -60,6 +68,14 @@
      */
     private String dummy3;
 
+    /**
+     * The suffix of the idTable-sql files.
+     *
+     * @parameter property="suffix"
+     *            expression="-idtable-init"
+     */
+    private String dummy4;
+ 
     /**
      * The initial ID of the idtables
      *

Modified: db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java
URL: http://svn.apache.org/viewvc/db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java?rev=591757&r1=591756&r2=591757&view=diff
==============================================================================
--- db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java (original)
+++ db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java Sun Nov
 4 02:53:08 2007
@@ -33,11 +33,11 @@
  * @goal sql
  * @phase generate-sources
  */
-public class SqlMojo extends DataModelTaskMojo
+public class SqlMojo extends SqlMojoBase
 {
     // The following three dummies trick the Mojo Description Extractor
     // into setting the correct default values for
-    // outputDir, reportFile and contextPropertiesPath
+    // outputDir, reportFile, contextPropertiesPath and suffix.
     /**
      * The directory in which the SQL will be generated.
      *
@@ -66,115 +66,8 @@
     /**
      * The suffix of the generated sql files.
      *
-     * @parameter expression=""
+     * @parameter property="suffix"
+     *            expression=""
      */
-    private String suffix;
-
-    /**
-     * The path to the xml schema file that defines the id-table, used
-     * by the idbroker method.
-     *
-     * @parameter expression=""
-     */
-    private String idTableXmlFile;
-
-    /**
-     * Creates a new SQLMojo object.
-     */
-    public SqlMojo()
-    {
-        super(new TorqueSQLTask());
-    }
-
-    /**
-     * Sets the suffix of the generated sql files.
-     *
-     * @param suffix the suffix of the generated sql files.
-     */
-    public void setSuffix(String suffix)
-    {
-        this.suffix = suffix;
-    }
-
-    /**
-     * Returns the suffix of the generated sql files.
-     *
-     * @return the suffix of the generated sql files.
-     */
-    public String getSuffix()
-    {
-        return suffix;
-    }
-
-    /**
-     * Set the path to the xml schema file that defines the id-table, used
-     * by the idbroker method.
-     *
-     * @param idXmlFile xml schema file
-     */
-    public void setIdTableXmlFile(String idXmlFile)
-    {
-        idTableXmlFile = idXmlFile;
-    }
-
-    /**
-     * Gets the id-table xml schema file path.
-     *
-     * @return Path to file.
-     */
-    public String getIdTableXMLFile()
-    {
-        return idTableXmlFile;
-    }
-
-    /**
-     * Returns the context properties for the Texen task.
-     *
-     * @return The PropertiesConfiguration containing all context properties,
-     *         not null.
-     */
-    protected PropertiesConfiguration getMojoContextProperties()
-    {
-        PropertiesConfiguration configuration = new PropertiesConfiguration();
-        configuration.addProperty(
-                TARGET_DATABASE_CONTEXT_PROPERTY,
-                super.getTargetDatabase());
-        return configuration;
-    }
-
-    /**
-     * Returns the path to the control template.
-     *
-     * @return "sql/Control.vm"
-     */
-    protected String getControlTemplate()
-    {
-        return "sql/base/Control.vm";
-    }
-
-    /**
-      * Configures the Texen task which is wrapped by this mojo.
-      * In this implementation, the context properties, useClasspath,
-      * the output directory, the control template, the schema Fileset,
-      * the target package, the target database  and the suffix are set.
-      *
-      * @throws MojoExecutionException if an error occurs when setting the Tasks
-      *         properties.
-      *
-      * @see TexenTaskMojo#configureTask()
-      */
-     protected void configureTask() throws MojoExecutionException
-     {  
-         super.configureTask();
-         
-         TorqueSQLTask task
-                 = (TorqueSQLTask) super.getGeneratorTask();
-       
-         if (suffix != null)
-         {  
-             getLog().debug("Adding suffix: " + suffix );
-             task.setSuffix(suffix);
-         }
-     
-     }
+    private String dummy4;
 }

Added: db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojoBase.java
URL: http://svn.apache.org/viewvc/db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojoBase.java?rev=591757&view=auto
==============================================================================
--- db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojoBase.java (added)
+++ db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojoBase.java Sun
Nov  4 02:53:08 2007
@@ -0,0 +1,148 @@
+package org.apache.torque.mojo;
+
+/*
+ * 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.commons.configuration.PropertiesConfiguration;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.torque.task.TorqueSQLTask;
+
+/**
+ * Generates SQL from the schema.xml files.
+ *
+ * @author Raphael Pieroni (rafale_at_codehaus.org)
+ * @author <a href="fischer@seitenbau.de">Thomas Fischer</a>
+ * @author <a href="kannegiesser@synyx.de">Marc Kannegiesser</a>
+ *
+ */
+public abstract class SqlMojoBase extends DataModelTaskMojo
+{
+    /**
+     * The suffix of the generated sql files.
+     */
+    private String suffix ="";
+
+    /**
+     * The path to the xml schema file that defines the id-table, used
+     * by the idbroker method.
+     *
+     * @parameter expression=""
+     */
+    private String idTableXmlFile;
+
+    /**
+     * Creates a new SQLMojo object.
+     */
+    public SqlMojoBase()
+    {
+        super(new TorqueSQLTask());
+    }
+
+    /**
+     * Sets the suffix of the generated sql files.
+     *
+     * @param suffix the suffix of the generated sql files.
+     */
+    public void setSuffix(String suffix)
+    {
+        this.suffix = suffix;
+    }
+
+    /**
+     * Returns the suffix of the generated sql files.
+     *
+     * @return the suffix of the generated sql files.
+     */
+    public String getSuffix()
+    {
+        return suffix;
+    }
+
+    /**
+     * Set the path to the xml schema file that defines the id-table, used
+     * by the idbroker method.
+     *
+     * @param idXmlFile xml schema file
+     */
+    public void setIdTableXmlFile(String idXmlFile)
+    {
+        idTableXmlFile = idXmlFile;
+    }
+
+    /**
+     * Gets the id-table xml schema file path.
+     *
+     * @return Path to file.
+     */
+    public String getIdTableXMLFile()
+    {
+        return idTableXmlFile;
+    }
+
+    /**
+     * Returns the context properties for the Texen task.
+     *
+     * @return The PropertiesConfiguration containing all context properties,
+     *         not null.
+     */
+    protected PropertiesConfiguration getMojoContextProperties()
+    {
+        PropertiesConfiguration configuration = new PropertiesConfiguration();
+        configuration.addProperty(
+                TARGET_DATABASE_CONTEXT_PROPERTY,
+                super.getTargetDatabase());
+        return configuration;
+    }
+
+    /**
+     * Returns the path to the control template.
+     *
+     * @return "sql/Control.vm"
+     */
+    protected String getControlTemplate()
+    {
+        return "sql/base/Control.vm";
+    }
+
+    /**
+      * Configures the Texen task which is wrapped by this mojo.
+      * In this implementation, the context properties, useClasspath,
+      * the output directory, the control template, the schema Fileset,
+      * the target package, the target database  and the suffix are set.
+      *
+      * @throws MojoExecutionException if an error occurs when setting the Tasks
+      *         properties.
+      *
+      * @see TexenTaskMojo#configureTask()
+      */
+     protected void configureTask() throws MojoExecutionException
+     {  
+         super.configureTask();
+         
+         TorqueSQLTask task
+                 = (TorqueSQLTask) super.getGeneratorTask();
+       
+         if (suffix != null)
+         {  
+             getLog().debug("Adding suffix: " + suffix );
+             task.setSuffix(suffix);
+         }
+     
+     }
+}

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?rev=591757&r1=591756&r2=591757&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Sun Nov  4 02:53:08 2007
@@ -31,6 +31,13 @@
 
   <body>
   <release version="3.3-RC3" date="in SVN">
+    <action type="change" dev="tfischer">
+      Maven 2 plugin: changed the default value of the parameter
+      &quot;suffix&quot; in the id-table-init-sql goal
+      to &quot;-idtable-init&quot; (was: &quot;&quot;).
+      This allows for automatic execution of the id-table-init-sql files in the
+      sqlExec goal with default settings.
+    </action>
     <action type="change" dev="tfischer" issue="TORQUE-105" due-to="Sylvain Benoist">
       Sybase: Columns where the attribute &quot;required&quot; 
       is not set or set to false are now created explicitly



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