You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by jg...@apache.org on 2008/12/22 16:41:16 UTC

svn commit: r728712 - in /ibatis/trunk/java/tools/ibator: core/build/ core/src/org/apache/ibatis/ibator/api/ core/src/org/apache/ibatis/ibator/config/ eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/

Author: jgbutler
Date: Mon Dec 22 07:41:15 2008
New Revision: 728712

URL: http://svn.apache.org/viewvc?rev=728712&view=rev
Log:
[Ibator] Plugin and documentation improvements

Modified:
    ibatis/trunk/java/tools/ibator/core/build/version.properties
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedTable.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/IbatorContext.java
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html
    ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html

Modified: ibatis/trunk/java/tools/ibator/core/build/version.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/build/version.properties?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/build/version.properties (original)
+++ ibatis/trunk/java/tools/ibator/core/build/version.properties Mon Dec 22 07:41:15 2008
@@ -1,4 +1,4 @@
 #Ibator build version info
-#Thu Dec 18 16:54:10 CST 2008
+#Sun Dec 21 20:24:13 CST 2008
 version=1.2.1
-buildNum=678
+buildNum=680

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedTable.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedTable.java?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedTable.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedTable.java Mon Dec 22 07:41:15 2008
@@ -111,7 +111,7 @@
     protected TableConfiguration tableConfiguration;
     protected FullyQualifiedTable fullyQualifiedTable;
     protected IbatorContext ibatorContext;
-    private IbatorRules rules;
+    protected IbatorRules rules;
     protected List<IntrospectedColumn> primaryKeyColumns;
     protected List<IntrospectedColumn> baseColumns;
     protected List<IntrospectedColumn> blobColumns;
@@ -328,16 +328,6 @@
     }
     
     public IbatorRules getRules() {
-        if (rules == null) {
-            if (tableConfiguration.getModelType() == ModelType.HIERARCHICAL) {
-                rules = new HierarchicalModelRules(tableConfiguration, this);
-            } else if (tableConfiguration.getModelType() == ModelType.FLAT) {
-                rules = new FlatModelRules(tableConfiguration, this);
-            } else {
-                rules = new ConditionalModelRules(tableConfiguration, this);
-            }
-        }
-        
         return rules;
     }
     
@@ -500,6 +490,14 @@
         calculateSqlMapPackage();
         calculateSqlMapFileName();
         
+        if (tableConfiguration.getModelType() == ModelType.HIERARCHICAL) {
+            rules = new HierarchicalModelRules(tableConfiguration, this);
+        } else if (tableConfiguration.getModelType() == ModelType.FLAT) {
+            rules = new FlatModelRules(tableConfiguration, this);
+        } else {
+            rules = new ConditionalModelRules(tableConfiguration, this);
+        }
+        
         ibatorContext.getPlugins().initialized(this);
     }
     
@@ -678,4 +676,14 @@
      * @return the number of progress messages
      */
     public abstract int getGenerationSteps();
+
+    /**
+     * This method exists to give plugins the opportunity
+     * to replace the calculated rules if necessary.
+     * 
+     * @param rules
+     */
+    public void setRules(IbatorRules rules) {
+        this.rules = rules;
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/IbatorContext.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/IbatorContext.java?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/IbatorContext.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/IbatorContext.java Mon Dec 22 07:41:15 2008
@@ -452,10 +452,6 @@
         } finally {
             closeConnection(connection);
         }
-        
-        for (IntrospectedTable introspectedTable : introspectedTables) {
-            introspectedTable.calculateGenerators(warnings, callback);
-        }
     }
 
     public int getGenerationSteps() {
@@ -495,6 +491,7 @@
                 callback.checkCancel();
 
                 introspectedTable.initialize();
+                introspectedTable.calculateGenerators(warnings, callback);
                 generatedJavaFiles.addAll(introspectedTable.getGeneratedJavaFiles());
                 generatedXmlFiles.addAll(introspectedTable.getGeneratedXmlFiles());
 

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html Mon Dec 22 07:41:15 2008
@@ -66,8 +66,8 @@
       /Ibator/source)</li>
       <li>Check out the source tree from the Subversion repository at
        <a href="http://svn.apache.org/repos/asf/ibatis/trunk/java/tools/ibator/">
-       http://svn.apache.org/repos/asf/ibatis/trunk/java/tools/ibator/</a></li>
-       <b>Note:</b> this will also checkout the source for the Ibator core JAR.
+       http://svn.apache.org/repos/asf/ibatis/trunk/java/tools/ibator/</a>
+       <b>Note:</b> this will also checkout the source for the Ibator core JAR.</li>
     </ol>
   </li>
   <li>Create a new Eclipse workspace directory (for example /EclipseWorkspaces/Ibator)</li>

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/eclipseui.html Mon Dec 22 07:41:15 2008
@@ -45,7 +45,7 @@
       included with the plugin.  You can attach this source archive to the
       Ibator JAR file to browse the source code.</li>
 </ul>
-<p>You can uses these variables to easily add Ibator to the build path of your
+<p>You can use these variables to easily add Ibator to the build path of your
 Ibator extension project.  Ibator also defines a menu option that will add these
 variables to any Java project.  Right click on any Java project, then
 take the menu option "Add Ibator to Build Path".</p>  

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/manualTesting.html Mon Dec 22 07:41:15 2008
@@ -8,9 +8,9 @@
 </head>
 <body>
 <h1>Manual Test Scripts</h1>
-<p>This page details test scripts for testing the different parts of the Ibator UI.
-This information may also be helpfol in learning how to use the different parts
-of the Eclipse user interface.</p>
+<p>This page lists scripts for testing the different parts of the Ibator UI.
+This information may also be helpful in learning how to use the different parts
+of the Eclipse user interface for Ibator.</p>
 <h2>Setup</h2>
 <ol>
   <li>Make sure that MySQL is installed and running.  The following scripts also assume
@@ -60,12 +60,12 @@
 <ol>
   <li>Start Eclipse if not already started</li>
   <li>Open the Eclipse help (Help&gt;Help Contents)</li>
-  <li>Ensure that the book "Apache iBATIS Ibator User's Guide" apprears
+  <li>Ensure that the book "Apache iBATIS Ibator User's Guide" appears
       in the contents.</li>
   <li>Ensure that every item in the contents points to a valid page,
       and that all pages are referenced in the table of contents.  This is
       especially important if new packages or help pages have been added anywhere.</li>
-  <li>Ensure that the latest version of the relase notes is shown both in the
+  <li>Ensure that the latest version of the release notes is shown both in the
       Eclipse UI documentation, and the Core Ibator documentation.</li>
 </ol>
 
@@ -133,7 +133,7 @@
     <li>Right click on the file, then take the option "Generate iBATIS Artifacts"</li>
     <li>Verify that code is generated in the two different source folders.  Code for table "a"
         should be in the "src" folder, code for tables "a" through "j" should be in the
-        "generatedsrc" folder.  Verify that there are no compliation errors or warnings.</li>
+        "generatedsrc" folder.  Verify that there are no compilation errors or warnings.</li>
 </ol>
 
 <h3>Java File Merger</h3>
@@ -167,7 +167,7 @@
   <li>Verify that <code>src.dao.ADAOImpl</code> doesn't extend anything.  There will be one
       error in the file related to the Spring import (the Java merger does not reconcile all
       imports).  Delete the import and verify that there are no other errors in the
-      workspace.  Also, verigy that the field <code>mergetest</code> and its
+      workspace.  Also, verify that the field <code>mergetest</code> and its
       associated getter and setter still exist.</li>
 </ol>
 
@@ -214,7 +214,54 @@
 
 <h3>Classpath Variables</h3>
 <ol>
-  <li></li>
+  <li>Create a new Java project called "IbatorPlugin".  Make sure that there are
+      seperate folders for source and class files.</li>
+  <li>Right click on the "IbatorPlugin" project, then take the menu option to
+      "Add Ibator to Build Path".</li>
+  <li>Verify that the IBATOR_JAR classpath variable has been added to the project's
+      build path.</li>
+  <li>Expand the Ibator JAR file, select any class and double click on the class.
+      Verify that the source code is attached and that you see the source code for
+      the class.</li>
+  <li>Make a new Java package called "plugin".</li>
+  <li>Make a new Java class called "plugin.TestPlugin" that extends
+      "IbatorPluginAdapter".</li>
+  <li>Change the generated <code>validate</code> method so that it returns
+      <code>true</code>.</li>
+  <li>Override the <code>modelBaseRecordClassGenerated</code> method and make
+      the method match the following:
+      <pre>
+
+@Override
+public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass,
+        IntrospectedTable introspectedTable) {
+
+    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("java.io.Serializable");
+
+    topLevelClass.addImportedType(fqjt);
+    topLevelClass.addSuperInterface(fqjt);
+
+    return true;
+}
+      </pre></li>
+  <li>Save and close the Java file.</li>
+  <li>Open the <code>ibatorConfig.xml</code> file from the previous tests.</li>
+  <li>Add the plugin to the configuration.  Add it after the first &lt;ibatorContext&gt;
+      element like this:
+      <pre>
+
+&lt;ibatorContext id="context1" targetRuntime="Ibatis2Java5" &gt;
+  &lt;ibatorPlugin type="plugin.TestPlugin"/&gt;
+  ...
+      </pre></li>
+  <li>Save and close the configuration file.</li>
+  <li>Right click on the <code>build.xml</code> file from the previous tests, then select the
+      menu option "Run As&gt;Ant Build...".  You should see the Ant launch configuration
+      dialog open.</li>
+  <li>Select the "Classpath" tab, then add the "bin" directory of the "IbatorPlugin" project
+      to "User Entries"</li>
+  <li>Press the "Run" button</li>
+  <li>After Ibator runs, you should see a "BUILD SUCCESSFUL" message.</li>
 </ol>
 
 </body>

Modified: ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html?rev=728712&r1=728711&r2=728712&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html (original)
+++ ibatis/trunk/java/tools/ibator/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/releasenotes.html Mon Dec 22 07:41:15 2008
@@ -10,9 +10,8 @@
 <h1>Ibator Eclipse Feature Release Notes</h1>
 <h2>Version 1.2.1</h2>
 <ul>
-  <li>Fixed an issue with the JavaFileMerger where it fails in the corner
-      case where a file does not exist, but is then generated more than
-      once by the same run of Ibator</li>
+  <li>Fixed an issue with the JavaFileMerger where it fails if the workspace
+      gets out of sync with the file system</li>
   <li>Added IBATOR_JAR classpath variable</li>
   <li>Added IBATOR_JAR_SRC classpath variable</li>
   <li>Added menu option to add Ibator to the build path of any Java project</li>