Author: jgbutler
Date: Wed Nov 12 15:19:31 2008
New Revision: 713555
URL: http://svn.apache.org/viewvc?rev=713555&view=rev
Log:
[ibator] Zeroing in on final API. More documentation.
Added:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java2Impl.java
(contents, props changed)
- copied, changed from r705122,
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Impl.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java5Impl.java
Removed:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Impl.java
Modified:
ibatis/trunk/java/tools/ibator/core/build/version.properties
ibatis/trunk/java/tools/ibator/core/buildsupport/org/apache/ibatis/ibator/build/EmmaDumperTask.java
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/classPathEntry.html
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/ibatorContext.html
ibatis/trunk/java/tools/ibator/core/htmldoc/migratingFromAbator.html
ibatis/trunk/java/tools/ibator/core/htmldoc/reference/extending.html
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedColumn.java
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/core/src/org/apache/ibatis/ibator/config/xml/IbatorConfigurationParser.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/ibator-config_1_0.dtd
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/model/ExampleGenerator.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorObjectFactory.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java
ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/ibatorConfig.xml
ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/ibatorConfig.xml
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=713555&r1=713554&r2=713555&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/build/version.properties (original)
+++ ibatis/trunk/java/tools/ibator/core/build/version.properties Wed Nov 12
15:19:31 2008
@@ -1,4 +1,4 @@
#ibator build version info
-#Wed Oct 15 21:47:23 CDT 2008
+#Wed Nov 12 13:18:01 CST 2008
version=1.2.0
-buildNum=636
+buildNum=639
Modified:
ibatis/trunk/java/tools/ibator/core/buildsupport/org/apache/ibatis/ibator/build/EmmaDumperTask.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/buildsupport/org/apache/ibatis/ibator/build/EmmaDumperTask.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/buildsupport/org/apache/ibatis/ibator/build/EmmaDumperTask.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/buildsupport/org/apache/ibatis/ibator/build/EmmaDumperTask.java
Wed Nov 12 15:19:31 2008
@@ -29,7 +29,7 @@
* lost if not forced to dump. BTW - this seems like a bug in emma!
* <p>
* This class is not intended to be used by clients. The class uses
- * reflection to dump emma so that the build is not dependant on emma.
+ * reflection to dump emma so that the build is not dependent on emma.
*
* @author Jeff Butler
*
Modified:
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/classPathEntry.html
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/classPathEntry.html?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/classPathEntry.html
(original)
+++
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/classPathEntry.html
Wed Nov 12 15:19:31 2008
@@ -32,7 +32,7 @@
<p><b>Important Note:</b> these locations are NOT used when loading classes
that
extend one of ibator's classes or implement one of ibator's interfaces. In
those cases
you must add your external classes to the runtime classpath in the same way you
-add ibator to the classpath (e,g, with the <code>-cp</code> argument of the
+add ibator to the classpath (e.g. with the <code>-cp</code> argument of the
<code>java</code> command).</p>
<h2>Required Attributes</h2>
Modified:
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/ibatorContext.html
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/ibatorContext.html?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/ibatorContext.html
(original)
+++
ibatis/trunk/java/tools/ibator/core/htmldoc/configreference/ibatorContext.html
Wed Nov 12 15:19:31 2008
@@ -77,13 +77,13 @@
</td>
</tr>
<tr>
- <td valign="top">targetJRE</td>
+ <td valign="top">targetRuntime</td>
<td>
- This property is used to specify the JRE under which the generated code
will run.
- The property supports these values:
+ This property is used to specify the runtime target for generated code.
+ The property supports these special values:
<table>
<tr>
- <th valign="top">Java2</th>
+ <th valign="top">Ibatis2Java2</th>
<td><i>This is the default value</i>
<br/>With this value, ibator will generate objects that are
compatible
with iBATIS versions 2.2.0 and higher, and all levels of Java 2.
@@ -94,7 +94,7 @@
of the other sets of code generators.</td>
</tr>
<tr>
- <th valign="top">Java5</th>
+ <th valign="top">Ibatis2Java5</th>
<td>With the value, ibator will generate objects that are compatible
with iBATIS versions 2.2.0 and higher, and JSE 5.0 and higher
(e.g. the
Java model and DAO classes will use generic types).
@@ -107,8 +107,23 @@
of the other sets of code generators.</td>
</tr>
</table>
+ <p>If you want to create a different code generator in entirety,
+ then use this value to specify the fully qualified name of a
+ class that extends
<code>org.apache.ibatis.ibator.api.IntrospectedTable</code>.
+ With this, you can create your own code generator and plug
+ it in to the ibator engine. See the
+ <a href="../reference/extending.html">Extending Ibator</a> page for
more information.
+ </p>
</td>
</tr>
+ <tr>
+ <td valign="top">introspectedColumnImpl</td>
+ <td>Use this value to specify the fully qualified name of a
+ class that extends
<code>org.apache.ibatis.ibator.api.IntrospectedColumn</code>.
+ This is used if you want to change the behavior of the code generators
+ when calculating column information. See the
+ <a href="../reference/extending.html">Extending Ibator</a> page for
more information.</td>
+ </tr>
</table>
<h2>Child Elements</h2>
Modified: ibatis/trunk/java/tools/ibator/core/htmldoc/migratingFromAbator.html
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/htmldoc/migratingFromAbator.html?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/htmldoc/migratingFromAbator.html
(original)
+++ ibatis/trunk/java/tools/ibator/core/htmldoc/migratingFromAbator.html Wed
Nov 12 15:19:31 2008
@@ -32,13 +32,15 @@
"http://ibatis.apache.org/dtd/ibator-config_1_0.dtd">
</pre>
</li>
- <li>The <abatorConfiguration> element is renamed to
<ibatorConfiguration></li>
- <li>The <abatorContext> element is renamed to
<ibatorContext></li>
- <li><ibatorContext> elements now require an ID</li>
+ <li>The <code><abatorConfiguration></code> element is renamed to
+ <code><ibatorConfiguration></code></li>
+ <li>The <code><abatorContext></code> element is renamed to
+ <code><ibatorContext></code></li>
+ <li><code><ibatorContext></code> elements now require an ID</li>
<li>The <code>generatorSet</code> attribute is removed from the
<code><ibatorContext></code> element and replaced with the
- <code>targetJRE</code> attribute. Valid values for this
- attribute are <code>Java2</code> or <code>Java5</code>.
+ <code>targetRuntime</code> attribute. Valid values for this
+ attribute are <code>IbatisJava2</code> or <code>Ibatis2Java5</code>.
Ibator does not include the legacy generator set from
Abator - so iBATIS version 2.2.0 or higher is required for
the code generated by ibator.</li>
@@ -50,7 +52,7 @@
page for full details.</li>
<li>The <code>type</code> attribute on the
<code><daoGenerator></code> element has a different meaning from the
- attribute in Abator. The special value remain the same, the difference
manifests
+ attribute in Abator. The special values remain the same, the difference
manifests
if you used this attribute the specify a custom DAO generator for Abator.
With Ibator,
the type specifies the type of a custom DAO template rather than an
implementation of a
custom DAO generator. Again, no changes are required unless you used this
attribute
Modified: ibatis/trunk/java/tools/ibator/core/htmldoc/reference/extending.html
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/htmldoc/reference/extending.html?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/htmldoc/reference/extending.html
(original)
+++ ibatis/trunk/java/tools/ibator/core/htmldoc/reference/extending.html Wed
Nov 12 15:19:31 2008
@@ -32,27 +32,58 @@
<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>.</p>
<h2>Extending Versus Plugging In</h2>
-<p>Although it is possible to implement ibator's key interfaces as shown on
this
+<p>Although there are a number of different extension points for ibator, as
shown on this
page, in most cases it will be far easier to extend ibator through the use of
a plugin. See the
<a href="pluggingIn.html">Implementing Ibator Plugins</a> reference page for
more information.</p>
-<p>The DAO, Java Model, and SQL Map generator interfaces are interrelated and
the code
-behind the interfaces is quite complex. In the years since the original
release of Abator,
-very few enhancement requests have appeared that could not be handled by a
plugin. If you
-intend to supply your own implementation of these interfaces, you should plan
to supply an
-implementation for <i>all three</i> interfaces. A good example of such an
implementation
-would be a FreeMarker or Velocity template based implementation of ibator. In
almost every
-other instance, a plugin is the better way to go.</p>
-
-<h2>org.apache.ibatis.ibator.generator.ibatis2.dao.templates.AbstractDAOTemplate</h2>
-<p>TODO</p>
+<p>The primary extension point for code generation is
+<code>org.apache.ibatis.ibator.api.IntrospectedTable</code>. Implementing a
code generator
+is a non-trivial task and should only be contemplated when you want to
completely replace
+the code generation activities of ibator. In the years since the original
release of Abator,
+very few enhancement requests have appeared that could not be handled by a
plugin.</p>
+
+<h2>Extension Points</h2>
+<p>Ibator includes a number of different extension points. The following
sections
+list the different methods of extending ibator, and describes the types of
+activities that can be accomplished with the different extensions. If you
+need some help understanding the different options, feel free to ask a question
+on the iBATIS user mailing list.</p>
+<h3>org.apache.ibatis.ibator.generator.ibatis2.dao.templates.AbstractDAOTemplate</h3>
+<p>Use this extension point if you need to generate DAO objects that are
different from
+one of ibator's built-in options. Classes that extend
<code>AbstractDAOTemplate</code>
+have the opportunity to override and implement a variety of different methods
that
+define how the DAO objects should be constructed, and how the DOAs interact
with iBATIS.</p>
+<p>If you implement this extension point, then you should specify the fully
qualified
+name of the implementing class on the <code>type</code> attribute of the
+<code><daoGenerator></code> configuration element.</p>
+
+<h3>org.apache.ibatis.ibator.api.IntrospectedTable</h3>
+<p><code>IntrospectedTable</code> is an abstract class that can be extended to
supply
+different code generators than the versions supplied with ibator. A good
example of
+such an implementation would be a FreeMarker or Velocity template based
+implementation of ibator. In most other instances, coding a plugin is the
better way to go.</p>
+<p>If you choose to extend this class, you must supply code to generate Java
model classes,
+DAO classes, and SQL Map XML files. You may choose to generated those
generators with the
+technology of your choice. You should also ensure that you follow all the
ibator rules for
+code generation (for example, do not generate a primary key class if the table
doesn't have
+a primary key). The base <code>IntrospectedTable</code> class holds an
instance
+of <code>org.apache.ibatis.ibator.internal.rules.IbatorRules</code> that can
be queried
+to determine many of the rules for code generation.</p>
+<p>If you choose to implement this extension point, specify the fully qualified
+class name of your implementation with the <code>targetRuntime</code>
+attribute of the <code><ibatorContext></code> element.</p>
+
+<h3>org.apache.ibatis.ibator.api.IntrospectedColumn</h3>
+<p><code>IntrospectedColumn</code> is a class that holds information about a
+column as it is returned from database metadata, as well as methods used
+during code generation to generate specific phrases for iBATIS. In some rare
+circumstances it might be desirable to override this class to provide
+your own implementation - especially if you create a new set of code
+generators for ibator.</p>
+<p>If you choose to implement this extension point, specify the fully qualified
+class name of your implementation with the <code>introspectedColumnImpl</code>
+attribute of the <code><ibatorContext></code> element.</p>
-<h2>org.apache.ibatis.ibator.api.IntrospectedTable</h2>
-<p>TODO</p>
-
-<h2>org.apache.ibatis.ibator.api.IntrospectedColumn</h2>
-<p>TODO</p>
-
-<h2>org.apache.ibatis.ibator.api.JavaTypeResolver</h2>
+<h3>org.apache.ibatis.ibator.api.JavaTypeResolver</h3>
<p>Ibator calls methods in this interface to map JDBC types to Java types
during database introspection. The default implementation of this
interface is
<code>org.apache.ibatis.ibator.internal.types.JavaTypeResolverDefaultImpl</code>.
@@ -67,7 +98,7 @@
</javaTypeResolver>
</pre>
-<h2>org.apache.ibatis.ibator.api.ShellCallback</h2>
+<h3>org.apache.ibatis.ibator.api.ShellCallback</h3>
<p>Ibator calls methods in this interface to perform functions that it cannot
do on its own. The most important of these functions are:</p>
<ul>
@@ -94,7 +125,7 @@
also providing some collateral code (like a new Ant task) to run
your implementation.</p>
-<h2>org.apache.ibatis.ibator.api.ProgressCallback</h2>
+<h3>org.apache.ibatis.ibator.api.ProgressCallback</h3>
<p>Ibator calls methods in this interface to report progress during the
generation of files (a long running process). The default implementation
of this interface is
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedColumn.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedColumn.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedColumn.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IntrospectedColumn.java
Wed Nov 12 15:19:31 2008
@@ -16,7 +16,6 @@
package org.apache.ibatis.ibator.api;
import java.sql.Types;
-import java.util.StringTokenizer;
import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
import org.apache.ibatis.ibator.config.IbatorContext;
@@ -30,31 +29,33 @@
* @author Jeff Butler
*/
public class IntrospectedColumn {
- private String actualColumnName;
+ protected String actualColumnName;
- private int jdbcType;
+ protected int jdbcType;
- private String jdbcTypeName;
+ protected String jdbcTypeName;
- private boolean nullable;
+ protected boolean nullable;
- private int length;
+ protected int length;
- private int scale;
+ protected int scale;
- private boolean identity;
+ protected boolean identity;
- private String javaProperty;
+ protected String javaProperty;
- private FullyQualifiedJavaType fullyQualifiedJavaType;
+ protected FullyQualifiedJavaType fullyQualifiedJavaType;
- private String tableAlias;
+ protected String tableAlias;
- private String typeHandler;
+ protected String typeHandler;
- private IbatorContext ibatorContext;
+ protected IbatorContext ibatorContext;
- private boolean isColumnNameDelimited;
+ protected boolean isColumnNameDelimited;
+
+ protected IntrospectedTable introspectedTable;
/**
* Constructs a Column definition. This object holds all the
@@ -64,10 +65,8 @@
* @param tableAlias The specified table alias, or null. This
* value is used to rename and alias column names for select statements
*/
- public IntrospectedColumn(String tableAlias, IbatorContext ibatorContext) {
+ public IntrospectedColumn() {
super();
- this.tableAlias = tableAlias;
- this.ibatorContext = ibatorContext;
}
public int getJdbcType() {
@@ -223,7 +222,7 @@
}
sb.append(tableAlias);
sb.append('_');
- sb.append(escapeStringForIbatis(actualColumnName));
+ sb.append(StringUtility.escapeStringForIbatis(actualColumnName));
if (isColumnNameDelimited) {
sb.append(ibatorContext.getEndingDelimiter());
}
@@ -276,22 +275,6 @@
this.typeHandler = typeHandler;
}
- private String escapeStringForIbatis(String s) {
- StringTokenizer st = new StringTokenizer(s, "$#", true); //$NON-NLS-1$
- StringBuilder sb = new StringBuilder();
- while (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("$".equals(token)) { //$NON-NLS-1$
- sb.append("$$"); //$NON-NLS-1$
- } else if ("#".equals(token)) { //$NON-NLS-1$
- sb.append("##"); //$NON-NLS-1$
- } else {
- sb.append(token);
- }
- }
-
- return sb.toString();
- }
public String getActualColumnName() {
return actualColumnName;
@@ -299,7 +282,7 @@
public String getEscapedColumnName() {
StringBuilder sb = new StringBuilder();
- sb.append(escapeStringForIbatis(actualColumnName));
+ sb.append(StringUtility.escapeStringForIbatis(actualColumnName));
if (isColumnNameDelimited) {
sb.insert(0, ibatorContext.getBeginningDelimiter());
@@ -387,4 +370,28 @@
FullyQualifiedJavaType fullyQualifiedJavaType) {
this.fullyQualifiedJavaType = fullyQualifiedJavaType;
}
+
+ public String getTableAlias() {
+ return tableAlias;
+ }
+
+ public void setTableAlias(String tableAlias) {
+ this.tableAlias = tableAlias;
+ }
+
+ public IbatorContext getIbatorContext() {
+ return ibatorContext;
+ }
+
+ public void setIbatorContext(IbatorContext ibatorContext) {
+ this.ibatorContext = ibatorContext;
+ }
+
+ public IntrospectedTable getIntrospectedTable() {
+ return introspectedTable;
+ }
+
+ public void setIntrospectedTable(IntrospectedTable introspectedTable) {
+ this.introspectedTable = introspectedTable;
+ }
}
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=713555&r1=713554&r2=713555&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
Wed Nov 12 15:19:31 2008
@@ -36,7 +36,10 @@
import org.apache.ibatis.ibator.internal.util.StringUtility;
/**
- * Read only interface for dealing with introspected tables.
+ * Base class for all code generator implementations.
+ * This class provides many of the ibator housekeeping methods needed
+ * to implement a code generator, with only the actual code generation
+ * methods left unimplemented.
*
* @author Jeff Butler
*
@@ -45,12 +48,12 @@
protected TableConfiguration tableConfiguration;
protected FullyQualifiedTable fullyQualifiedTable;
protected IbatorContext ibatorContext;
- private IbatorRules rules;
- private List<IntrospectedColumn> primaryKeyColumns;
- private List<IntrospectedColumn> baseColumns;
- private List<IntrospectedColumn> blobColumns;
- private boolean hasJDBCDateColumns;
- private boolean hasJDBCTimeColumns;
+ protected IbatorRules rules;
+ protected List<IntrospectedColumn> primaryKeyColumns;
+ protected List<IntrospectedColumn> baseColumns;
+ protected List<IntrospectedColumn> blobColumns;
+ protected boolean hasJDBCDateColumns;
+ protected boolean hasJDBCTimeColumns;
public IntrospectedTable() {
super();
@@ -410,6 +413,8 @@
if (introspectedColumn.isJDBCTimeColumn()) {
hasJDBCTimeColumns = true;
}
+
+ introspectedColumn.setIntrospectedTable(this);
}
public void addPrimaryKeyColumn(String columnName) {
@@ -470,4 +475,12 @@
* @return the list of generated XML files for this table
*/
public abstract List<GeneratedXmlFile> getGeneratedXmlFiles();
+
+ /**
+ * Denotes whether generated code is targeted for Java version 5.0
+ * or higher.
+ *
+ * @return true if the generated code makes use of Java5 features
+ */
+ public abstract boolean isJava5Targeted();
}
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=713555&r1=713554&r2=713555&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
Wed Nov 12 15:19:31 2008
@@ -73,21 +73,19 @@
private List<IbatorPluginConfiguration> pluginConfigurations;
- private String targetJRE;
+ private String targetRuntime;
+ private String introspectedColumnImpl;
+
/**
* Constructs an IbatorContext object.
*
- * @param targetJRE -
- * may be null
* @param defaultModelType -
* may be null
*/
- public IbatorContext(String targetJRE, ModelType defaultModelType) {
+ public IbatorContext(ModelType defaultModelType) {
super();
- this.targetJRE = targetJRE;
-
if (defaultModelType == null) {
this.defaultModelType = ModelType.CONDITIONAL;
} else {
@@ -235,7 +233,7 @@
/**
* Builds an XmlElement representation of this context. Note that the XML
- * may not necessarity validate if the context is invalid. Call the
+ * may not necessarily validate if the context is invalid. Call the
* <code>validate</code> method to check validity of this context.
*
* @return the XML representation of this context
@@ -248,9 +246,14 @@
"defaultModelType", defaultModelType.getModelType()));
//$NON-NLS-1$
}
- if (StringUtility.stringHasValue(targetJRE)) {
+ if (StringUtility.stringHasValue(introspectedColumnImpl)) {
+ xmlElement.addAttribute(new Attribute(
+ "introspectedColumnImpl", introspectedColumnImpl));
//$NON-NLS-1$
+ }
+
+ if (StringUtility.stringHasValue(targetRuntime)) {
xmlElement.addAttribute(new Attribute(
- "targetJRE", targetJRE)); //$NON-NLS-1$
+ "targetRuntime", targetRuntime)); //$NON-NLS-1$
}
addPropertyXmlElements(xmlElement);
@@ -311,10 +314,6 @@
}
}
- public boolean getSuppressTypeWarnings() {
- return suppressTypeWarnings && !"Java5".equalsIgnoreCase(targetJRE);
- }
-
public CommentGenerator getCommentGenerator() {
if (commentGenerator == null) {
commentGenerator =
IbatorObjectFactory.createCommentGenerator(this);
@@ -336,10 +335,6 @@
return pluginAggregator;
}
- public String getTargetJRE() {
- return targetJRE;
- }
-
/**
* Generate iBATIS artifacts based on the configuration specified in the
* constructor. This method is long running.
@@ -509,4 +504,24 @@
}
}
}
+
+ public String getTargetRuntime() {
+ return targetRuntime;
+ }
+
+ public void setTargetRuntime(String targetRuntime) {
+ this.targetRuntime = targetRuntime;
+ }
+
+ public String getIntrospectedColumnImpl() {
+ return introspectedColumnImpl;
+ }
+
+ public void setIntrospectedColumnImpl(String introspectedColumnImpl) {
+ this.introspectedColumnImpl = introspectedColumnImpl;
+ }
+
+ public boolean getSuppressTypeWarnings(IntrospectedTable
introspectedTable) {
+ return suppressTypeWarnings && !introspectedTable.isJava5Targeted();
+ }
}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/IbatorConfigurationParser.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/IbatorConfigurationParser.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/IbatorConfigurationParser.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/IbatorConfigurationParser.java
Wed Nov 12 15:19:31 2008
@@ -237,15 +237,22 @@
Node node) {
Properties attributes = parseAttributes(node);
- String targetJRE = attributes.getProperty("targetJRE"); //$NON-NLS-1$
String defaultModelType = attributes.getProperty("defaultModelType");
//$NON-NLS-1$
+ String targetRuntime = attributes.getProperty("targetRuntime");
//$NON-NLS-1$
+ String introspectedColumnImpl =
attributes.getProperty("introspectedColumnImpl"); //$NON-NLS-1$
String id = attributes.getProperty("id"); //$NON-NLS-1$
ModelType mt = defaultModelType == null ? null : ModelType
.getModelType(defaultModelType);
- IbatorContext ibatorContext = new IbatorContext(targetJRE, mt);
+ IbatorContext ibatorContext = new IbatorContext(mt);
ibatorContext.setId(id);
+ if (StringUtility.stringHasValue(introspectedColumnImpl)) {
+ ibatorContext.setIntrospectedColumnImpl(introspectedColumnImpl);
+ }
+ if (StringUtility.stringHasValue(targetRuntime)) {
+ ibatorContext.setTargetRuntime(targetRuntime);
+ }
ibatorConfiguration.addIbatorContext(ibatorContext);
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/ibator-config_1_0.dtd
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/ibator-config_1_0.dtd?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/ibator-config_1_0.dtd
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/config/xml/ibator-config_1_0.dtd
Wed Nov 12 15:19:31 2008
@@ -54,7 +54,8 @@
javaModelGenerator, sqlMapGenerator, daoGenerator?,
table+)>
<!ATTLIST ibatorContext id ID #REQUIRED
defaultModelType CDATA #IMPLIED
- targetJRE CDATA #IMPLIED>
+ targetRuntime CDATA #IMPLIED
+ introspectedColumnImpl CDATA #IMPLIED>
<!--
The jdbcConnection element is used to describe the JDBC connection that
ibator
Copied:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java2Impl.java
(from r705122,
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Impl.java)
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java2Impl.java?p2=ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java2Impl.java&p1=ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Impl.java&r1=705122&r2=713555&rev=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Impl.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java2Impl.java
Wed Nov 12 15:19:31 2008
@@ -45,12 +45,12 @@
* @author Jeff Butler
*
*/
-public class IntrospectedTableIbatis2Impl extends IntrospectedTable {
+public class IntrospectedTableIbatis2Java2Impl extends IntrospectedTable {
protected List<JavaGenerator> javaModelGenerators;
protected List<JavaGenerator> daoGenerators;
protected XmlGenerator sqlMapGenerator;
- public IntrospectedTableIbatis2Impl() {
+ public IntrospectedTableIbatis2Java2Impl() {
super();
javaModelGenerators = new ArrayList<JavaGenerator>();
daoGenerators = new ArrayList<JavaGenerator>();
@@ -88,17 +88,14 @@
abstractDAOTemplate = (AbstractDAOTemplate)
IbatorObjectFactory.createInternalObject(type);
}
- boolean generateForJava5 =
"Java5".equalsIgnoreCase(ibatorContext.getTargetJRE());
- JavaGenerator javaGenerator = new DAOGenerator(abstractDAOTemplate,
generateForJava5);
+ JavaGenerator javaGenerator = new DAOGenerator(abstractDAOTemplate,
isJava5Targeted());
initializeAbstractGenerator(javaGenerator, warnings, progressCallback);
daoGenerators.add(javaGenerator);
}
protected void calculateJavaModelGenerators(List<String> warnings,
ProgressCallback progressCallback) {
- boolean generateForJava5 =
"Java5".equalsIgnoreCase(ibatorContext.getTargetJRE());
-
if (getRules().generateExampleClass()) {
- JavaGenerator javaGenerator = new
ExampleGenerator(generateForJava5);
+ JavaGenerator javaGenerator = new
ExampleGenerator(isJava5Targeted());
initializeAbstractGenerator(javaGenerator, warnings,
progressCallback);
javaModelGenerators.add(javaGenerator);
}
@@ -168,4 +165,9 @@
return answer;
}
+
+ @Override
+ public boolean isJava5Targeted() {
+ return false;
+ }
}
Propchange:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java2Impl.java
------------------------------------------------------------------------------
svn:mergeinfo =
Added:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java5Impl.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java5Impl.java?rev=713555&view=auto
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java5Impl.java
(added)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/IntrospectedTableIbatis2Java5Impl.java
Wed Nov 12 15:19:31 2008
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2008 The Apache Software Foundation
+ *
+ * Licensed 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.ibatis.ibator.generator.ibatis2;
+
+/**
+ *
+ * @author Jeff Butler
+ *
+ */
+public class IntrospectedTableIbatis2Java5Impl extends
IntrospectedTableIbatis2Java2Impl {
+ @Override
+ public boolean isJava5Targeted() {
+ return true;
+ }
+}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java
Wed Nov 12 15:19:31 2008
@@ -103,7 +103,7 @@
}
method.setReturnType(returnType);
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
method.addSuppressTypeWarningsAnnotation();
}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java
Wed Nov 12 15:19:31 2008
@@ -107,7 +107,7 @@
method.setReturnType(returnType);
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
method.addSuppressTypeWarningsAnnotation();
}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java
Wed Nov 12 15:19:31 2008
@@ -75,8 +75,6 @@
method.addBodyLine("return record;"); //$NON-NLS-1$
innerClass.addMethod(method);
- // TODO - plugin method?
-
topLevelClass.addInnerClass(innerClass);
}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/model/ExampleGenerator.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/model/ExampleGenerator.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/model/ExampleGenerator.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/model/ExampleGenerator.java
Wed Nov 12 15:19:31 2008
@@ -72,7 +72,7 @@
method.addBodyLine("oredCriteria = new ArrayList<Criteria>();");
//$NON-NLS-1$
} else {
method.addBodyLine("oredCriteria = new ArrayList();");
//$NON-NLS-1$
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
method.addSuppressTypeWarningsAnnotation();
}
}
@@ -134,7 +134,7 @@
}
field.setType(fqjt);
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
field.addSuppressTypeWarningsAnnotation();
}
field.setName("oredCriteria"); //$NON-NLS-1$
@@ -144,7 +144,7 @@
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(fqjt);
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
method.addSuppressTypeWarningsAnnotation();
}
method.setName("getOredCriteria"); //$NON-NLS-1$
@@ -154,7 +154,7 @@
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
method.addSuppressTypeWarningsAnnotation();
}
method.setName("or"); //$NON-NLS-1$
@@ -167,7 +167,7 @@
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
method.addSuppressTypeWarningsAnnotation();
}
method.setName("createCriteria"); //$NON-NLS-1$
@@ -215,7 +215,7 @@
InnerClass answer = new InnerClass(FullyQualifiedJavaType
.getCriteriaInstance());
- if (ibatorContext.getSuppressTypeWarnings()) {
+ if (ibatorContext.getSuppressTypeWarnings(introspectedTable)) {
answer.addSuppressTypeWarningsAnnotation();
}
answer.setVisibility(JavaVisibility.PUBLIC);
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorObjectFactory.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorObjectFactory.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorObjectFactory.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorObjectFactory.java
Wed Nov 12 15:19:31 2008
@@ -20,6 +20,7 @@
import org.apache.ibatis.ibator.api.CommentGenerator;
import org.apache.ibatis.ibator.api.FullyQualifiedTable;
import org.apache.ibatis.ibator.api.IbatorPlugin;
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
import org.apache.ibatis.ibator.api.IntrospectedTable;
import org.apache.ibatis.ibator.api.JavaTypeResolver;
import org.apache.ibatis.ibator.config.CommentGeneratorConfiguration;
@@ -27,8 +28,10 @@
import org.apache.ibatis.ibator.config.IbatorPluginConfiguration;
import org.apache.ibatis.ibator.config.JavaTypeResolverConfiguration;
import org.apache.ibatis.ibator.config.TableConfiguration;
-import org.apache.ibatis.ibator.generator.ibatis2.IntrospectedTableIbatis2Impl;
+import
org.apache.ibatis.ibator.generator.ibatis2.IntrospectedTableIbatis2Java2Impl;
+import
org.apache.ibatis.ibator.generator.ibatis2.IntrospectedTableIbatis2Java5Impl;
import org.apache.ibatis.ibator.internal.types.JavaTypeResolverDefaultImpl;
+import org.apache.ibatis.ibator.internal.util.StringUtility;
import org.apache.ibatis.ibator.internal.util.messages.Messages;
/**
@@ -174,9 +177,14 @@
public static IntrospectedTable createIntrospectedTable(TableConfiguration
tableConfiguration,
FullyQualifiedTable table, IbatorContext ibatorContext) {
- // TODO - this method should decide what implementation based on some
- // configuration setting (getting ready for iBATIS 3)
- String type = IntrospectedTableIbatis2Impl.class.getName();
+ String type = ibatorContext.getTargetRuntime();
+ if (!StringUtility.stringHasValue(type)) {
+ type = IntrospectedTableIbatis2Java2Impl.class.getName();
+ } else if ("Ibatis2Java2".equalsIgnoreCase(type)) {
+ type = IntrospectedTableIbatis2Java2Impl.class.getName();
+ } else if ("Ibatis2Java5".equalsIgnoreCase(type)) {
+ type = IntrospectedTableIbatis2Java5Impl.class.getName();
+ }
IntrospectedTable answer = (IntrospectedTable)
createInternalObject(type);
answer.setFullyQualifiedTable(table);
@@ -185,4 +193,16 @@
return answer;
}
+
+ public static IntrospectedColumn createIntrospectedColumn(IbatorContext
ibatorContext) {
+ String type = ibatorContext.getIntrospectedColumnImpl();
+ if (!StringUtility.stringHasValue(type)) {
+ type = IntrospectedColumn.class.getName();
+ }
+
+ IntrospectedColumn answer = (IntrospectedColumn)
createInternalObject(type);
+ answer.setIbatorContext(ibatorContext);
+
+ return answer;
+ }
}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
Wed Nov 12 15:19:31 2008
@@ -398,9 +398,9 @@
localTableName, null);
while (rs.next()) {
- // TODO - needs to be configurable
- IntrospectedColumn introspectedColumn = new
IntrospectedColumn(tc.getAlias(), ibatorContext);
+ IntrospectedColumn introspectedColumn =
IbatorObjectFactory.createIntrospectedColumn(ibatorContext);
+ introspectedColumn.setTableAlias(tc.getAlias());
introspectedColumn.setJdbcType(rs.getInt("DATA_TYPE"));
//$NON-NLS-1$
introspectedColumn.setLength(rs.getInt("COLUMN_SIZE"));
//$NON-NLS-1$
introspectedColumn.setActualColumnName(rs.getString("COLUMN_NAME"));
//$NON-NLS-1$
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
Wed Nov 12 15:19:31 2008
@@ -94,4 +94,21 @@
public static boolean isTrue(String s) {
return "true".equalsIgnoreCase(s); //$NON-NLS-1$
}
+
+ public static String escapeStringForIbatis(String s) {
+ StringTokenizer st = new StringTokenizer(s, "$#", true); //$NON-NLS-1$
+ StringBuilder sb = new StringBuilder();
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if ("$".equals(token)) { //$NON-NLS-1$
+ sb.append("$$"); //$NON-NLS-1$
+ } else if ("#".equals(token)) { //$NON-NLS-1$
+ sb.append("##"); //$NON-NLS-1$
+ } else {
+ sb.append(token);
+ }
+ }
+
+ return sb.toString();
+ }
}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/messages/messages.properties
Wed Nov 12 15:19:31 2008
@@ -69,7 +69,7 @@
Progress.0=Connecting to the Database
Progress.1=Introspecting table {0}
-Progress.3=XML Parser Errors occured:
+Progress.3=XML Parser Errors occurred:
Progress.4=ibator finshed successfully.
Progress.5=ibator finshed successfully, there were warninigs.
Progress.6=Generating Example class for table {0}
Modified:
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java
(original)
+++
ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java
Wed Nov 12 15:19:31 2008
@@ -27,7 +27,6 @@
import org.apache.ibatis.ibator.api.dom.java.Method;
import org.apache.ibatis.ibator.api.dom.java.Parameter;
import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
-import org.apache.ibatis.ibator.config.IbatorContext;
import org.apache.ibatis.ibator.internal.util.JavaBeansUtil;
/**
@@ -41,15 +40,13 @@
* The <tt>hashCode</tt> method generated by this class is a very simplistic
* implementation. A better implementation would rely on the HashCodeUtil
* from www.javapractices.com - but we do not want to introduce another
- * dependancy in this simple plugin.
+ * dependency in this simple plugin.
*
* @author Jeff Butler
*
*/
public class EqualsHashCodePlugin extends IbatorPluginAdapter {
- private boolean usingJava5;
-
public EqualsHashCodePlugin() {
}
@@ -61,13 +58,6 @@
}
@Override
- public void setIbatorContext(IbatorContext ibatorContext) {
- super.setIbatorContext(ibatorContext);
- usingJava5 = "Java5".equalsIgnoreCase(ibatorContext //$NON-NLS-1$
- .getTargetJRE());
- }
-
- @Override
public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
List<IntrospectedColumn> columns;
@@ -130,7 +120,7 @@
method.setName("equals"); //$NON-NLS-1$
method.addParameter(new Parameter(FullyQualifiedJavaType
.getObjectInstance(), "that")); //$NON-NLS-1$
- if (usingJava5) {
+ if (introspectedTable.isJava5Targeted()) {
method.addAnnotation("@Override"); //$NON-NLS-1$
}
@@ -222,7 +212,7 @@
method.setReturnType(FullyQualifiedJavaType
.getIntInstance());
method.setName("hashCode"); //$NON-NLS-1$
- if (usingJava5) {
+ if (introspectedTable.isJava5Targeted()) {
method.addAnnotation("@Override"); //$NON-NLS-1$
}
Modified:
ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/ibatorConfig.xml
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/ibatorConfig.xml?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
---
ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/ibatorConfig.xml
(original)
+++
ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/ibatorConfig.xml
Wed Nov 12 15:19:31 2008
@@ -5,7 +5,7 @@
<ibatorConfiguration>
- <ibatorContext id="FlatJava2" targetJRE="Java2" defaultModelType="flat">
+ <ibatorContext id="FlatJava2" targetRuntime="Ibatis2Java2"
defaultModelType="flat">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.SqlMapConfigPlugin" >
<property name="targetPackage" value="ibatortest.java2.generated.flat" />
@@ -49,7 +49,7 @@
</table>
</ibatorContext>
- <ibatorContext id="HierarchicalJava2" targetJRE="Java2"
defaultModelType="hierarchical">
+ <ibatorContext id="HierarchicalJava2" targetRuntime="Ibatis2Java2"
defaultModelType="hierarchical">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<jdbcConnection driverClass="org.hsqldb.jdbcDriver"
@@ -89,7 +89,7 @@
</table>
</ibatorContext>
- <ibatorContext id="ConditionalJava2" targetJRE="Java2"
defaultModelType="conditional">
+ <ibatorContext id="ConditionalJava2" targetRuntime="Ibatis2Java2"
defaultModelType="conditional">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<jdbcConnection driverClass="org.hsqldb.jdbcDriver"
@@ -129,7 +129,7 @@
</table>
</ibatorContext>
- <ibatorContext id="miscellaneousTests" targetJRE="Java2">
+ <ibatorContext id="miscellaneousTests" targetRuntime="Ibatis2Java2">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<jdbcConnection driverClass="org.hsqldb.jdbcDriver"
Modified:
ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/ibatorConfig.xml
URL:
http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/ibatorConfig.xml?rev=713555&r1=713554&r2=713555&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/ibatorConfig.xml
(original)
+++ ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/ibatorConfig.xml
Wed Nov 12 15:19:31 2008
@@ -6,7 +6,7 @@
<ibatorConfiguration>
<classPathEntry location="${generated.bin.dir.java5}"/>
- <ibatorContext id="FlatJava5" targetJRE="Java5" defaultModelType="flat">
+ <ibatorContext id="FlatJava5" targetRuntime="Ibatis2Java5"
defaultModelType="flat">
<property name="suppressTypeWarnings" value="true" /> <!-- should be
ignored -->
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
@@ -52,7 +52,7 @@
</table>
</ibatorContext>
- <ibatorContext id="FlatJava2" targetJRE="Java2" defaultModelType="flat">
+ <ibatorContext id="FlatJava2" targetRuntime="Ibatis2Java2"
defaultModelType="flat">
<property name="suppressTypeWarnings" value="true" />
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
@@ -94,7 +94,7 @@
</table>
</ibatorContext>
- <ibatorContext id="HierarchicalJava5" targetJRE="Java5"
defaultModelType="hierarchical">
+ <ibatorContext id="HierarchicalJava5" targetRuntime="Ibatis2Java5"
defaultModelType="hierarchical">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<jdbcConnection driverClass="org.hsqldb.jdbcDriver"
@@ -134,7 +134,7 @@
</table>
</ibatorContext>
- <ibatorContext id="HierarchicalJava2" targetJRE="Java2"
defaultModelType="hierarchical">
+ <ibatorContext id="HierarchicalJava2" targetRuntime="Ibatis2Java2"
defaultModelType="hierarchical">
<property name="suppressTypeWarnings" value="true" />
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
@@ -176,7 +176,7 @@
</table>
</ibatorContext>
- <ibatorContext id="ConditionalJava5" targetJRE="Java5"
defaultModelType="conditional">
+ <ibatorContext id="ConditionalJava5" targetRuntime="Ibatis2Java5"
defaultModelType="conditional">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.SerializablePlugin" />
@@ -217,7 +217,7 @@
</table>
</ibatorContext>
- <ibatorContext id="ConditionalJava2" targetJRE="Java2"
defaultModelType="conditional">
+ <ibatorContext id="ConditionalJava2" targetRuntime="Ibatis2Java2"
defaultModelType="conditional">
<property name="suppressTypeWarnings" value="true" />
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
@@ -259,7 +259,7 @@
</table>
</ibatorContext>
- <ibatorContext id="miscellaneousTests" targetJRE="Java5">
+ <ibatorContext id="miscellaneousTests" targetRuntime="Ibatis2Java5">
<ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin"
/>
<commentGenerator>