cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r600412 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/ framework/cayenne-jdk1.5-...
Date Sun, 02 Dec 2007 23:58:32 GMT
Author: aadamchik
Date: Sun Dec  2 15:58:29 2007
New Revision: 600412

URL: http://svn.apache.org/viewvc?rev=600412&view=rev
Log:
CAY-927 Switch to version 1.2 as default generation mechanism , deprecate 1.1 generator

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/docs/doc/src/main/resources/UPGRADE.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/MapClassGenerator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/singleclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/subclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/superclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSingleTemplateTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSuperTemplateTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorTestBase.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testtemplate.vm
    cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun Dec  2 15:58:29 2007
@@ -23,6 +23,7 @@
 CAY-916 Ordering should be able to ignore paths with null elements
 CAY-918 An exception during in-memory sorting of IncrementalFaultList
 CAY-921 Remove DerviedDbEntity support from Cayenne
+CAY-927 Switch to version 1.2 as default generation mechanism , deprecate 1.1 generator
 
 Bug fixes since M2:
 

Modified: cayenne/main/trunk/docs/doc/src/main/resources/UPGRADE.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/UPGRADE.txt?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/UPGRADE.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/UPGRADE.txt Sun Dec  2 15:58:29 2007
@@ -21,6 +21,10 @@
   - A new "cayenne-agent-x.x.x.jar" is included. It is used for class enhancement 
     with POJO's and JPA. "Classic" Cayenne users can ignore this file.
     
+* Ant class generator is using what was called "version 1.2" by default. This means that
if you were
+  using custom Velocity templates in 1.1 mode, you should either change the templates or
specify 'version="1.1"'
+  in the buildfile explicitly.
+
 * Cross-platform Modeler Startup is now done without a batch file or a shell script. 
   A "fat" CayenneModeler.jar is included in the "cayenne-x.x.x/bin" directory
   and can be run either by double-clicking the jar (on platforms that support that)

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
Sun Dec  2 15:58:29 2007
@@ -100,15 +100,14 @@
 
         TemplateProcessor mainGenSetup = new TemplateProcessor(classTemplate, context);
         TemplateProcessor superGenSetup = new TemplateProcessor(superTemplate, context);
+        StringUtils stringUtils = StringUtils.getInstance();
 
         for (ObjEntity ent : entitiesForCurrentMode()) {
 
             String fqnSubClass = ent.getClassName();
-            String fqnBaseClass = (null != ent.getSuperClassName()) ? ent
+            String fqnBaseClass = (ent.getSuperClassName() != null) ? ent
                     .getSuperClassName() : CayenneDataObject.class.getName();
 
-            StringUtils stringUtils = StringUtils.getInstance();
-
             String subClassName = stringUtils.stripPackageName(fqnSubClass);
             String subPackageName = stringUtils.stripClass(fqnSubClass);
 
@@ -116,6 +115,9 @@
                     + stringUtils.stripPackageName(fqnSubClass);
 
             String superPackageName = this.superPkg;
+            if(superPackageName == null) {
+                superPackageName = subPackageName;
+            }
             String fqnSuperClass = superPackageName + "." + superClassName;
 
             Writer superOut = openWriter(ent, superPackageName, superClassName);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
Sun Dec  2 15:58:29 2007
@@ -46,7 +46,6 @@
 
     public EntityUtils(DataMap dataMap, ObjEntity objEntity, String fqnBaseClass,
             String fqnSuperClass, String fqnSubClass) {
-        super();
 
         StringUtils stringUtils = StringUtils.getInstance();
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/MapClassGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/MapClassGenerator.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/MapClassGenerator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/MapClassGenerator.java
Sun Dec  2 15:58:29 2007
@@ -72,7 +72,7 @@
     protected static final String VERSION_1_1 = ClassGenerator.VERSION_1_1;
     protected static final String VERSION_1_2 = ClassGenerator.VERSION_1_2;
 
-    public static final String DEFAULT_VERSION = VERSION_1_1;
+    public static final String DEFAULT_VERSION = VERSION_1_2;
 
     public static final String MODE_DATAMAP = "datamap";
     public static final String MODE_ENTITY = "entity";

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
Sun Dec  2 15:58:29 2007
@@ -27,7 +27,6 @@
 import org.apache.cayenne.gen.ClassGeneratorMode;
 import org.apache.cayenne.gen.ClientClassGenerationAction;
 import org.apache.cayenne.gen.DefaultClassGenerator;
-import org.apache.cayenne.gen.MapClassGenerator;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.Path;
@@ -70,7 +69,6 @@
         this.mode = ClassGeneratorMode.entity.name();
         this.outputPattern = "*.java";
         this.usepkgpath = true;
-        this.version = MapClassGenerator.DEFAULT_VERSION;
     }
 
     protected VelocityContext getVppContext() {
@@ -258,17 +256,6 @@
      * @deprecated since 3.0
      */
     public void setVersion(String version) {
-        if (!ClassGenerator.VERSION_1_1.equals(version)
-                && !ClassGenerator.VERSION_1_2.equals(version)) {
-            throw new BuildException("'version' must be '"
-                    + ClassGenerator.VERSION_1_1
-                    + "' or '"
-                    + ClassGenerator.VERSION_1_2
-                    + "', but was '"
-                    + version
-                    + "'");
-        }
-
         this.version = version;
     }
 
@@ -325,5 +312,4 @@
             vppConfig = VPPConfig.getDefaultConfig(getProject());
         }
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/singleclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/singleclass.vm?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/singleclass.vm
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/singleclass.vm
Sun Dec  2 15:58:29 2007
@@ -22,6 +22,8 @@
 import java.util.List;
 
 #end
+/** WARNING: This template is deprecated in Cayenne 3.0
+  */
 public class $classGen.className extends $classGen.superClassName {
 
 ## Create property names

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/subclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/subclass.vm?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/subclass.vm
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/subclass.vm
Sun Dec  2 15:58:29 2007
@@ -22,6 +22,8 @@
 import ${classGen.superPackageName}.${classGen.superPrefix}${classGen.className};
 #end
 
+/** WARNING: This template is deprecated in Cayenne 3.0
+  */
 public class ${classGen.className} extends ${classGen.superPrefix}${classGen.className} {
 
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/superclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/superclass.vm?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/superclass.vm
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/superclass.vm
Sun Dec  2 15:58:29 2007
@@ -18,7 +18,8 @@
 package ${classGen.packageName};
 
 #end
-/** Class ${classGen.superPrefix}${classGen.className} was generated by Cayenne.
+/** WARNING: This template is deprecated in Cayenne 3.0
+  * Class ${classGen.superPrefix}${classGen.className} was generated by Cayenne.
   * It is probably a good idea to avoid changing this class manually, 
   * since it may be overwritten next time code is regenerated. 
   * If you need to make any customizations, please use subclass. 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSingleTemplateTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSingleTemplateTest.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSingleTemplateTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSingleTemplateTest.java
Sun Dec  2 15:58:29 2007
@@ -25,11 +25,12 @@
 
 /**
  * @author Andrus Adamchik
+ * @deprecated since 3.0
  */
 public class ClassGeneratorSingleTemplateTest extends ClassGeneratorTestBase {
 
     protected ClassGenerator createGenerator() throws Exception {
-        return new ClassGenerator(MapClassGenerator.SINGLE_CLASS_TEMPLATE, MapClassGenerator.DEFAULT_VERSION);
+        return new ClassGenerator(MapClassGenerator.SINGLE_CLASS_TEMPLATE, ClassGenerator.VERSION_1_1);
     }
 
     public void testNoImports() throws Exception {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSuperTemplateTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSuperTemplateTest.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSuperTemplateTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorSuperTemplateTest.java
Sun Dec  2 15:58:29 2007
@@ -23,10 +23,13 @@
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 
+/**
+ * @deprecated since 3.0
+ */
 public class ClassGeneratorSuperTemplateTest extends ClassGeneratorTestBase {
 
     protected ClassGenerator createGenerator() throws Exception {
-        return new ClassGenerator(MapClassGenerator.SUPERCLASS_TEMPLATE, MapClassGenerator.DEFAULT_VERSION);
+        return new ClassGenerator(MapClassGenerator.SUPERCLASS_TEMPLATE, ClassGenerator.VERSION_1_1);
     }
 
     public void testNoImports() throws Exception {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorTestBase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorTestBase.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorTestBase.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/gen/ClassGeneratorTestBase.java
Sun Dec  2 15:58:29 2007
@@ -26,6 +26,7 @@
 
 /**
  * Superclass of ClassGenerator tests.
+ * @deprecated since 3.0
  */
 public abstract class ClassGeneratorTestBase extends BasicCase {
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testtemplate.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testtemplate.vm?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testtemplate.vm
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testtemplate.vm
Sun Dec  2 15:58:29 2007
@@ -1,8 +1,6 @@
 ## Test Velocity template
-
-#if( ${classGen.isUsingPackage()} )
-package ${classGen.packageName};
-#end
+${importUtils.setPackage($entityUtils.subPackageName)}##
+${importUtils.generate()}
 
 import java.util.List;
 import org.apache.cayenne.*;
@@ -12,4 +10,4 @@
   * since it may be overwritten next time code is regenerated. 
   * If you need to make any customizations, please use subclass. 
   */
-public class ${classGen.className} extends CayenneDataObject {
+public class ${entityUtils.subClassName} extends CayenneDataObject {

Modified: cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java?rev=600412&r1=600411&r2=600412&view=diff
==============================================================================
--- cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
(original)
+++ cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
Sun Dec  2 15:58:29 2007
@@ -196,7 +196,7 @@
 	 * "importUtils" in the velocity context. (Default is
 	 * "1.2".)
 	 * 
-	 * @parameter expression="${cgen.version}" default-value="1.1"
+	 * @parameter expression="${cgen.version}"
 	 */
 	private String version;
 



Mime
View raw message