Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 17787 invoked from network); 1 Oct 2007 07:25:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Oct 2007 07:25:40 -0000 Received: (qmail 87789 invoked by uid 500); 1 Oct 2007 07:25:29 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 87771 invoked by uid 500); 1 Oct 2007 07:25:29 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 87760 invoked by uid 500); 1 Oct 2007 07:25:29 -0000 Received: (qmail 87757 invoked by uid 99); 1 Oct 2007 07:25:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2007 00:25:29 -0700 X-ASF-Spam-Status: No, hits=-97.9 required=10.0 tests=ALL_TRUSTED,DNS_FROM_DOB,RCVD_IN_DOB,URIBL_RHS_DOB X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2007 07:25:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 116E71A9832; Mon, 1 Oct 2007 00:25:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r580875 - in /db/torque: maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java site/trunk/xdocs/changes.xml test/trunk/test-project/pom.xml Date: Mon, 01 Oct 2007 07:25:14 -0000 To: torque-commits@db.apache.org From: tfischer@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071001072516.116E71A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tfischer Date: Mon Oct 1 00:25:08 2007 New Revision: 580875 URL: http://svn.apache.org/viewvc?rev=580875&view=rev Log: - Added the id-table-init-sql goal to the maven2 plugin - the suffix parameter in the sql goal in the maven2 plugin now works. Fixes TORQUE-101. Thanks to Marc Kannegiesser for the patch. Added: db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java Modified: db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/SqlMojo.java db/torque/site/trunk/xdocs/changes.xml db/torque/test/trunk/test-project/pom.xml Added: 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=580875&view=auto ============================================================================== --- db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java (added) +++ db/torque/maven2-plugin/trunk/src/main/java/org/apache/torque/mojo/IdTableInitSqlMojo.java Mon Oct 1 00:25:08 2007 @@ -0,0 +1,189 @@ +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.torque.task.TorqueSQLTask; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * Generates SQL for creating the database from the schema.xml files. + * + * @author Raphael Pieroni (rafale_at_codehaus.org) + * @author Thomas Fischer + * @author Marc Kannegiesser + * + * @goal id-table-init-sql + * @phase generate-sources + */ +public class IdTableInitSqlMojo extends SqlMojo +{ + public static final String INITIALID_CONTEXT_PROPERTY + = "initialID"; + public static final String INITIALIDVALUE_CONTEXT_PROPERTY + = "initialIDValue"; + public static final String INITIALIDSTEP_CONTEXT_PROPERTY + = "initialIDStep"; + + // The following dummies trick the Mojo Description Extractor + // into setting the correct default values for + // reportFile and contextPropertiesPath + /** + * The location where the report file will be generated. + * + * @parameter property="reportFile" + * expression="../../torque/report.${project.artifact.artifactId}.idtable-init-sql.generation" + */ + private String dummy2; + + /** + * The location where the context property file for velocity will be + * generated. + * + * @parameter property="contextPropertiesPath" + * expression="${project.build.directory}/torque/context.idtable-init-sql.properties" + */ + private String dummy3; + + /** + * The initial ID of the idtables + * + * @parameter expression="101" + */ + private String initialID; + + /** + * The initial IDValue of the idtable + * + * @parameter expression="1000" + */ + private String initialIDValue; + + /** + * The initial ID Step of the idtable + * + * @parameter expression="10" + */ + private String initialIDStep; + + /** + * Creates a new IdTableInitSqlMojo object. + */ + public IdTableInitSqlMojo() + { + } + + /** + * Sets the initial id of the idtables + * + * @param initialID The initial of the idtables + */ + public void setInitialID(String initialID) + { + this.initialID = initialID; + } + + /** + * Returns the initial id of the idtable + * + * @return initialID The initial ID of the idtables + */ + public String getInitialID() + { + return this.initialID; + } + + + + /** + * Sets the initial id value of the idtables + * + * @param initialIDValue The initial id value of the tables + */ + public void setInitialIDValue(String initialIDValue) + { + this.initialIDValue = initialIDValue; + } + + /** + * Returns the initial id value of the idtables + * + * @return initialIDValue the initial id value of the idtables + */ + public String getInitialIDValue() + { + return this.initialIDValue; + } + + + + /** + * Sets the initial id step of the idtables + * + * @param initialIDStep The initial id step of the tables + */ + public void setInitialIDStep(String initialIDStep) + { + this.initialIDStep = initialIDStep; + } + + /** + * Returns the initial id step of the idtables + * + * @return initialIDStep the initial id step of the idtables + */ + public String getInitialIDStep() + { + return this.initialIDStep; + } + + /** + * Returns the context properties for the Texen task. + * + * @return The PropertiesConfiguration containing all context properties, + * not null. + */ + protected PropertiesConfiguration getMojoContextProperties() + { + PropertiesConfiguration configuration = super.getMojoContextProperties(); + configuration.addProperty( + INITIALID_CONTEXT_PROPERTY, + initialID); + + configuration.addProperty( + INITIALIDVALUE_CONTEXT_PROPERTY, + initialIDValue); + + configuration.addProperty( + INITIALIDSTEP_CONTEXT_PROPERTY, + initialIDStep); + return configuration; + } + + /** + * Returns the path to the control template. + * + * @return "sql/id-table/Control.vm" + */ + protected String getControlTemplate() + { + return "sql/id-table/Control.vm"; + } +} 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=580875&r1=580874&r2=580875&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 Mon Oct 1 00:25:08 2007 @@ -20,6 +20,7 @@ */ import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.maven.plugin.MojoExecutionException; import org.apache.torque.task.TorqueSQLTask; /** @@ -27,6 +28,7 @@ * * @author Raphael Pieroni (rafale_at_codehaus.org) * @author Thomas Fischer + * @author Marc Kannegiesser * * @goal sql * @phase generate-sources @@ -149,4 +151,30 @@ { 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=580875&r1=580874&r2=580875&view=diff ============================================================================== --- db/torque/site/trunk/xdocs/changes.xml (original) +++ db/torque/site/trunk/xdocs/changes.xml Mon Oct 1 00:25:08 2007 @@ -31,6 +31,12 @@ + + Implemented the goal id-broker-init-sql in the Maven2 plugin. + + + The suffix parameter to the Maven2-plugin's sql task now works. + Added copy(..) and add(..) methods with a connection parameter. Modified: db/torque/test/trunk/test-project/pom.xml URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/pom.xml?rev=580875&r1=580874&r2=580875&view=diff ============================================================================== --- db/torque/test/trunk/test-project/pom.xml (original) +++ db/torque/test/trunk/test-project/pom.xml Mon Oct 1 00:25:08 2007 @@ -160,6 +160,7 @@ sql sqlExec documentation + id-table-init-sql --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org