cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r592238 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools: CayenneGenerator.java CayenneTask.java DataPortTask.java DbGeneratorTask.java DeploymentConfigurator.java
Date Tue, 06 Nov 2007 03:25:22 GMT
Author: kmenard
Date: Mon Nov  5 19:25:20 2007
New Revision: 592238

URL: http://svn.apache.org/viewvc?rev=592238&view=rev
Log:
Fixed WWW-263: cdbgen (DbGeneratorTask) must support classpath and classpathref.

Also added the classpath and classpathref attributes to the other three ant tasks.

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneTask.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGenerator.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGenerator.java?rev=592238&r1=592237&r2=592238&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGenerator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGenerator.java
Mon Nov  5 19:25:20 2007
@@ -36,7 +36,7 @@
  * 
  * @author Andrus Adamchik, Kevin Menard
  */
-public class CayenneGenerator extends Task {
+public class CayenneGenerator extends CayenneTask {
 
     protected String includeEntitiesPattern;
     protected String excludeEntitiesPattern;

Added: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneTask.java?rev=592238&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneTask.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/CayenneTask.java
Mon Nov  5 19:25:20 2007
@@ -0,0 +1,66 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ * Base task for all Cayenne ant tasks, providing support for common configuration items.
+ *
+ * @author Kevin Menard
+ * @since 1.2
+ */
+public class CayenneTask extends Task
+{
+    protected Path classpath;
+
+    /**
+     * Sets the classpath used by the task.
+     *
+     * @param path The classpath to set.
+     */
+    public void setClasspath(Path path) {
+        createClasspath().append(path);
+    }
+
+    /**
+     * Sets the classpath reference used by the task.
+     *
+     * @param reference The classpath reference to set.
+     */
+    public void setClasspathRef(Reference reference) {
+        createClasspath().setRefid(reference);
+    }
+
+    /**
+     * Convenience method for creating a classpath instance to be used for the task.
+     *
+     * @return The new classpath.
+     */
+    private Path createClasspath() {
+        if (null == classpath) {
+            classpath = new Path(getProject());
+        }
+
+        return classpath.createPath();
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java?rev=592238&r1=592237&r2=592238&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DataPortTask.java
Mon Nov  5 19:25:20 2007
@@ -42,7 +42,7 @@
  * @author Andrus Adamchik
  * @since 1.2: Prior to 1.2 DataPort classes were a part of cayenne-examples package.
  */
-public class DataPortTask extends Task {
+public class DataPortTask extends CayenneTask {
 
     protected File projectFile;
     protected String maps;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java?rev=592238&r1=592237&r2=592238&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
Mon Nov  5 19:25:20 2007
@@ -38,11 +38,11 @@
  * An Ant Task that is a frontend to Cayenne DbGenerator allowing schema generation from
  * DataMap using Ant.
  * 
- * @author nirvdrum, Andrus Adamchik
+ * @author Kevin Menard, Andrus Adamchik
  * @since 1.2
  */
 // TODO: support classpath attribute for loading the driver
-public class DbGeneratorTask extends Task {
+public class DbGeneratorTask extends CayenneTask {
 
     protected DbAdapter adapter;
     protected File map;
@@ -51,7 +51,7 @@
     protected String userName;
     protected String password;
 
-    // DbGenerator options... setup defaults similar to DbGemerator itself:
+    // DbGenerator options... setup defaults similar to DbGenerator itself:
     // all DROP set to false, all CREATE - to true
     protected boolean dropTables;
     protected boolean dropPK;
@@ -59,7 +59,6 @@
     protected boolean createPK = true;
     protected boolean createFK = true;
 
-
     public void execute() {
 
         // prepare defaults
@@ -233,5 +232,4 @@
     public void setPassword(String password) {
         this.password = password;
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java?rev=592238&r1=592237&r2=592238&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
Mon Nov  5 19:25:20 2007
@@ -36,7 +36,7 @@
  * 
  * @author Andrus Adamchik
  */
-public class DeploymentConfigurator extends Task {
+public class DeploymentConfigurator extends CayenneTask {
 
     protected ProjectConfigInfo info;
 



Mime
View raw message