svn commit: r916007 - in /ibatis/java/ibator/trunk/eclipse: org.apache.ibatis.ibator.build/ org.apache.ibatis.ibator.core/ org.apache.ibatis.ibator.eclipse.core/META-INF/ org.apache.ibatis.ibator.ecli
Author: jgbutler Date: Wed Feb 24 22:28:06 2010 New Revision: 916007 URL: http://svn.apache.org/viewvc?rev=916007view=rev Log: [Ibator] More Eclipse Build Improvements Added: ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.core/customBuildCallbacks.xml ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator/sourceTemplateFeature/ ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator/sourceTemplateFeature/LICENSE ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator/sourceTemplateFeature/NOTICE ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator/sourceTemplateFeature/feature.properties Modified: ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.properties ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.xml ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.core/build.properties ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.core/META-INF/MANIFEST.MF ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.ui/META-INF/MANIFEST.MF ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.ui/plugin.xml ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/IbatorClasspathVariableInitializer.java ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/actions/AddIbatorAction.java ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.ui/src/org/apache/ibatis/ibator/eclipse/ui/content/AdapterFactory.java ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator/build.properties ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator/feature.xml Modified: ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.properties URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.properties?rev=916007r1=916006r2=916007view=diff == --- ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.properties (original) +++ ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.properties Wed Feb 24 22:28:06 2010 @@ -36,7 +36,7 @@ #archiveNamePrefix= # The prefix that will be used in the generated archive. -archivePrefix=eclipse +archivePrefix= # The location underwhich all of the build output will be collected. collectingFolder=${archivePrefix} Modified: ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.xml URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.xml?rev=916007r1=916006r2=916007view=diff == --- ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.xml (original) +++ ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.build/build.xml Wed Feb 24 22:28:06 2010 @@ -1,36 +1,11 @@ -!-- - This program and the accompanying materials are made available - under the terms of the Eclipse Public License v1.0 which - accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - This build script creates a build directory containing the plugins - and features to be built, and then kicks off the PDE build process. - You could just as easily do this from a shell script or cron job. - - Also, the script can be run inside the Eclipse IDE by choosing - Run As - Ant Build from the context menu. It could obviously be - run outside of the IDE if you have ANT installed on your path. - - If you have any questions about this build, feel free to contact me - at patr...@rcpquickstart.com. --- project name=org.apache.ibatis.ibator.build default=build property file=build.properties / - !-- - PDE Build expects that the build directory contains a plugins - directory and a features directory. These directories should contain - the various plug-ins and features to be built. - - It's possible to use the CVS checkout process that is built into - PDE Build. This is done with map files and is beyond the scope of - this tutorial. - - This tutorial simply copies the projects directly from your workspace - into the appropriate build directory folders. - -- target name=init + !-- First, regenerate the documentation -- + ant antfile=../org.apache.ibatis.ibator.eclipse.doc/buildDoc.xml + dir=../org.apache.ibatis.ibator.eclipse.doc / +
svn commit: r916087 - in /ibatis/java/ibatis-3/trunk/ibatis-3-core/src: main/java/org/apache/ibatis/type/UnknownTypeHandler.java test/java/org/apache/ibatis/type/UnknownTypeHandlerTest.java
Author: cbegin Date: Thu Feb 25 02:14:48 2010 New Revision: 916087 URL: http://svn.apache.org/viewvc?rev=916087view=rev Log: implemented better type handler detection in unknowntypehandler. Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/type/UnknownTypeHandler.java ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/type/UnknownTypeHandlerTest.java Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/type/UnknownTypeHandler.java URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/type/UnknownTypeHandler.java?rev=916087r1=916086r2=916087view=diff == --- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/type/UnknownTypeHandler.java (original) +++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/type/UnknownTypeHandler.java Thu Feb 25 02:14:48 2010 @@ -1,6 +1,6 @@ package org.apache.ibatis.type; -import org.apache.ibatis.exceptions.IbatisException; +import org.apache.ibatis.io.Resources; import java.sql.*; import java.util.*; @@ -58,10 +58,7 @@ Integer columnIndex = columnIndexLookup.get(column); TypeHandler handler = null; if (columnIndex != null) { -int jdbcTypeInt = rsmd.getColumnType(columnIndex); -JdbcType jdbcType = JdbcType.forCode(jdbcTypeInt); - -handler = typeHandlerRegistry.getTypeHandler(jdbcType); +handler = resolveTypeHandler(rsmd, columnIndex); } if (handler == null || handler instanceof UnknownTypeHandler) { handler = OBJECT_TYPE_HANDLER; @@ -72,4 +69,34 @@ } } + private TypeHandler resolveTypeHandler(ResultSetMetaData rsmd, Integer columnIndex) throws SQLException { +TypeHandler handler = null; +JdbcType jdbcType = safeGetJdbcTypeForColumn(rsmd, columnIndex); +Class javaType = safeGetClassForColumn(rsmd, columnIndex); +if (javaType != null jdbcType != null) { + handler = typeHandlerRegistry.getTypeHandler(javaType, jdbcType); +} else if (javaType != null) { + handler = typeHandlerRegistry.getTypeHandler(javaType); +} else if (jdbcType != null) { + handler = typeHandlerRegistry.getTypeHandler(jdbcType); +} +return handler; + } + + private JdbcType safeGetJdbcTypeForColumn(ResultSetMetaData rsmd, Integer columnIndex) { +try { + return JdbcType.forCode(rsmd.getColumnType(columnIndex)); +} catch (Exception e) { + return null; +} + } + + private Class safeGetClassForColumn(ResultSetMetaData rsmd, Integer columnIndex) { +try { + return Resources.classForName(rsmd.getColumnClassName(columnIndex)); +} catch (Exception e) { + return null; +} + } + } Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/type/UnknownTypeHandlerTest.java URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/type/UnknownTypeHandlerTest.java?rev=916087r1=916086r2=916087view=diff == --- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/type/UnknownTypeHandlerTest.java (original) +++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/type/UnknownTypeHandlerTest.java Thu Feb 25 02:14:48 2010 @@ -31,6 +31,8 @@ will(returnValue(1)); one(rsmd).getColumnName(with(any(int.class))); will(returnValue(column)); +one(rsmd).getColumnClassName(with(any(int.class))); +will(returnValue(String.class)); one(rsmd).getColumnType(with(any(int.class))); will(returnValue(JdbcType.VARCHAR.TYPE_CODE)); one(rs).getString(with(any(String.class)));