[jboss-svn-commits] JBL Code SVN: r35710 - in labs/jbosstm/trunk: ArjunaJTA/jdbc and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 25 09:24:36 EDT 2010


Author: jhalliday
Date: 2010-10-25 09:24:36 -0400 (Mon, 25 Oct 2010)
New Revision: 35710

Removed:
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC3.java
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC4.java
Modified:
   labs/jbosstm/trunk/ArjunaJTA/jdbc/build.xml
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionManager.java
   labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/jdbc/logging/jdbcI18NLogger.java
   labs/jbosstm/trunk/Build.txt
Log:
Removed obsolete JDBC3 connection wrapper code. JBTM-812


Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/build.xml	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/build.xml	2010-10-25 13:24:36 UTC (rev 35710)
@@ -22,8 +22,6 @@
 
     <property name="modulename" value="jdbc"/>
 
-    <property name="excluded.classes" value="**/*JDBC3.java"/>
-
     <property name="global.ext.libs" value="jboss-transaction-api_1.1_spec.jar,jboss-logging.jar"/>
 
     <import file="../../sharedbuild.xml"/>

Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImple.java	2010-10-25 13:24:36 UTC (rev 35710)
@@ -62,18 +62,12 @@
  *
  * Applications must not use this class directly.
  *
- * Because of API changes between JDBC 3.0 (jdk 5) and JDBC 4.0 (jdk 6)
- * it is not possible to write a single class that 'implements Connection'
- * and compiles on both JDKs. Thus this class does not implement the interface
- * but provides a home for methods that will compile on either. See also
- * ConnectionImpleJDBC3, ConnectionImpleJDBC4 and ConnectionManager
- *
  * @author Mark Little (mark at arjuna.com)
  * @version $Id: ConnectionImple.java 2342 2006-03-30 13:06:17Z $
  * @since JTS 2.0.
  */
 
-public abstract class ConnectionImple
+public class ConnectionImple implements Connection
 {
 
 	public ConnectionImple(String dbName, Properties info) throws SQLException
@@ -617,8 +611,152 @@
 	 */
 
 
+    /*
+     * ******************************************************************* *
+     * JDBC 4.0 method section.
+     */
 
+    public Clob createClob() throws SQLException
+    {
+        checkTransaction();
 
+        registerDatabase();
+
+        return getConnection().createClob();
+    }
+
+    public Blob createBlob() throws SQLException
+    {
+        checkTransaction();
+
+        registerDatabase();
+
+        return getConnection().createBlob();
+    }
+
+    public NClob createNClob() throws SQLException
+    {
+        checkTransaction();
+
+		registerDatabase();
+
+		return getConnection().createNClob();
+    }
+
+    public SQLXML createSQLXML() throws SQLException
+    {
+        checkTransaction();
+
+		registerDatabase();
+
+		return getConnection().createSQLXML();
+    }
+
+    public boolean isValid(int timeout) throws SQLException
+    {
+        checkTransaction();
+
+        registerDatabase();
+
+        return getConnection().isValid(timeout);
+    }
+
+    public String getClientInfo(String name) throws SQLException
+    {
+        return getConnection().getClientInfo(name);
+    }
+
+    public Properties getClientInfo() throws SQLException
+    {
+        return getConnection().getClientInfo();
+    }
+
+    public void setClientInfo(String name, String value) throws SQLClientInfoException
+    {
+        try
+        {
+    		getConnection().setClientInfo(name, value);
+        }
+        catch(SQLException e)
+        {
+            throw new SQLClientInfoException("setClientInfo : getConnection failed", null, e);
+        }
+    }
+
+    public void setClientInfo(Properties properties) throws SQLClientInfoException
+    {
+        try
+        {
+    		getConnection().setClientInfo(properties);
+        }
+        catch(SQLException e)
+        {
+            throw new SQLClientInfoException("setClientInfo : getConnection failed", null, e);
+        }
+    }
+
+    public Array createArrayOf(String typeName, Object[] elements) throws SQLException
+    {
+        checkTransaction();
+
+        registerDatabase();
+
+        return getConnection().createArrayOf(typeName, elements);
+    }
+
+    public Struct createStruct(String typeName, Object[] attributes) throws SQLException
+    {
+        checkTransaction();
+
+        registerDatabase();
+
+        return getConnection().createStruct(typeName, attributes);
+    }
+
+    public <T> T unwrap(Class<T> iface) throws SQLException
+    {
+        if (iface != null) {
+            if (iface.isInstance(this)) {
+                return (T) this;
+            } else {
+                Connection conn = getConnection();
+                if (conn != null) {
+                    if (iface.isInstance(conn)) {
+                        return (T) conn;
+                    } else if(conn.isWrapperFor(iface)) {
+                        return conn.unwrap(iface);
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    public boolean isWrapperFor(Class<?> iface) throws SQLException
+    {
+        if (iface != null) {
+            if (iface.isInstance(this)) {
+                return true;
+            } else {
+                Connection conn = getConnection();
+                if (conn != null) {
+                    if (iface.isInstance(conn)) {
+                        return true;
+                    } else {
+                        return conn.isWrapperFor(iface);
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /*
+	 * end of the JDBC 4.0 section
+	 * *******************************************************************
+	 */
+
+
     /**
 	 * @return the XAResource associated with the current XAConnection.
 	 */

Deleted: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC3.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC3.java	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC3.java	2010-10-25 13:24:36 UTC (rev 35710)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- * (C) 2006, 2009
- * @author JBoss Inc.
- *
- * $Id$
- */
-
-package com.arjuna.ats.internal.jdbc;
-
-import java.sql.*;
-import java.util.Properties;
-
-/**
- * JDBC 3.0 extention to the Connection wrapper.
- * Since ConnectionImple now implements all the JDBC3 functions we don't
- * have much to do. This class only really exists to add the
- * 'implements Connection' clause.
- */
-public class ConnectionImpleJDBC3 extends ConnectionImple implements Connection
-{
-	public ConnectionImpleJDBC3(String dbName, Properties info) throws SQLException {
-		super(dbName, info);
-	}
-}

Deleted: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC4.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC4.java	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionImpleJDBC4.java	2010-10-25 13:24:36 UTC (rev 35710)
@@ -1,186 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * (C) 2009 @author JBoss Inc
- */
-package com.arjuna.ats.internal.jdbc;
-
-import java.sql.*;
-import java.util.Properties;
-
-/**
- * JDBC 4.0 extention to the Connection wrapper.
- * ConnectionImple 'implements' JDBC3, this subclass
- * adds those that use methods only present in the JDK 1.6 standard library.
- */
-public class ConnectionImpleJDBC4 extends ConnectionImple implements Connection
-{
-	public ConnectionImpleJDBC4(String dbName, Properties info) throws SQLException {
-		super(dbName, info);
-	}
-
-    /*
-     * ******************************************************************* *
-     * JDBC 4.0 method section.
-     */
-
-
-
-    public Clob createClob() throws SQLException
-    {
-        checkTransaction();
-
-        registerDatabase();
-
-        return getConnection().createClob();
-    }
-
-    public Blob createBlob() throws SQLException
-    {
-        checkTransaction();
-
-        registerDatabase();
-
-        return getConnection().createBlob();
-    }
-
-    public NClob createNClob() throws SQLException
-    {
-        checkTransaction();
-
-		registerDatabase();
-
-		return getConnection().createNClob();
-    }
-
-    public SQLXML createSQLXML() throws SQLException
-    {
-        checkTransaction();
-
-		registerDatabase();
-
-		return getConnection().createSQLXML();
-    }
-
-    public boolean isValid(int timeout) throws SQLException
-    {
-        checkTransaction();
-
-        registerDatabase();
-
-        return getConnection().isValid(timeout);
-    }
-
-    public String getClientInfo(String name) throws SQLException
-    {
-        return getConnection().getClientInfo(name);
-    }
-
-    public Properties getClientInfo() throws SQLException
-    {
-        return getConnection().getClientInfo();
-    }
-
-    public void setClientInfo(String name, String value) throws SQLClientInfoException
-    {
-        try
-        {
-    		getConnection().setClientInfo(name, value);
-        }
-        catch(SQLException e)
-        {
-            throw new SQLClientInfoException("setClientInfo : getConnection failed", null, e);
-        }
-    }
-
-    public void setClientInfo(Properties properties) throws SQLClientInfoException
-    {
-        try
-        {
-    		getConnection().setClientInfo(properties);
-        }
-        catch(SQLException e)
-        {
-            throw new SQLClientInfoException("setClientInfo : getConnection failed", null, e);
-        }
-    }
-
-    public Array createArrayOf(String typeName, Object[] elements) throws SQLException
-    {
-        checkTransaction();
-
-        registerDatabase();
-
-        return getConnection().createArrayOf(typeName, elements);
-    }
-
-    public Struct createStruct(String typeName, Object[] attributes) throws SQLException
-    {
-        checkTransaction();
-
-        registerDatabase();
-
-        return getConnection().createStruct(typeName, attributes);
-    }
-
-    public <T> T unwrap(Class<T> iface) throws SQLException
-    {
-        if (iface != null) {
-            if (iface.isInstance(this)) {
-                return (T) this;
-            } else {
-                Connection conn = getConnection();
-                if (conn != null) {
-                    if (iface.isInstance(conn)) {
-                        return (T) conn;
-                    } else if(conn.isWrapperFor(iface)) {
-                        return conn.unwrap(iface);
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    public boolean isWrapperFor(Class<?> iface) throws SQLException
-    {
-        if (iface != null) {
-            if (iface.isInstance(this)) {
-                return true;
-            } else {
-                Connection conn = getConnection();
-                if (conn != null) {
-                    if (iface.isInstance(conn)) {
-                        return true;
-                    } else {
-                        return conn.isWrapperFor(iface);
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /*
-	 * end of the JDBC 4.0 section
-	 * *******************************************************************
-	 */
-}

Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionManager.java	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/internal/jdbc/ConnectionManager.java	2010-10-25 13:24:36 UTC (rev 35710)
@@ -107,37 +107,8 @@
             }
         }
 
-        // the ConnectionImple subclass is loaded dynamically because we only have one or the
-        // other available at build time, so we can't reference either directly in the code.
-        // See ConnectionImple javadoc.
+        ConnectionImple conn = new ConnectionImple(dbUrl, info);
 
-        String connectionImpleClassName = "com.arjuna.ats.internal.jdbc.ConnectionImpleJDBC4";
-        ConnectionImple conn;
-        try
-        {
-            Class clazz = Class.forName(connectionImpleClassName);
-            Constructor ctor = clazz.getConstructor(new Class[] { String.class, Properties.class} );
-            conn =  (ConnectionImple)ctor.newInstance(new Object[] { dbUrl, info });
-        }
-        catch(Exception exception)
-        {
-            // not necessarily an error, we may have a JDK5 build that does not include the JDBC4 driver.
-            // try to fallback to the older driver
-            connectionImpleClassName = "com.arjuna.ats.internal.jdbc.ConnectionImpleJDBC3";
-            try
-            {
-                Class clazz = Class.forName(connectionImpleClassName);
-                Constructor ctor = clazz.getConstructor(new Class[] { String.class, Properties.class} );
-                conn =  (ConnectionImple)ctor.newInstance(new Object[] { dbUrl, info });
-            }
-            catch(Exception e)
-            {
-                SQLException sqlException = new SQLException(jdbcLogger.i18NLogger.get_nojdbcimple(connectionImpleClassName));
-                sqlException.initCause(e);
-                throw sqlException;
-            }
-        }
-
         /*
        * Will replace any old (closed) connection which had the
        * same connection information.

Modified: labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/jdbc/logging/jdbcI18NLogger.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/jdbc/logging/jdbcI18NLogger.java	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/ArjunaJTA/jdbc/classes/com/arjuna/ats/jdbc/logging/jdbcI18NLogger.java	2010-10-25 13:24:36 UTC (rev 35710)
@@ -125,8 +125,8 @@
 	@Message(id = 17025, value = "Could not resolve JNDI XADataSource", format = MESSAGE_FORMAT)
 	public String get_jndierror();
 
-	@Message(id = 17026, value = "Can't load ConnectionImple class {0}", format = MESSAGE_FORMAT)
-	public String get_nojdbcimple(String arg0);
+//	@Message(id = 17026, value = "Can't load ConnectionImple class {0}", format = MESSAGE_FORMAT)
+//	public String get_nojdbcimple(String arg0);
 
 	@Message(id = 17027, value = "An exception occurred during initialisation.", format = MESSAGE_FORMAT)
 	@LogMessage(level = WARN)

Modified: labs/jbosstm/trunk/Build.txt
===================================================================
--- labs/jbosstm/trunk/Build.txt	2010-10-25 13:18:02 UTC (rev 35709)
+++ labs/jbosstm/trunk/Build.txt	2010-10-25 13:24:36 UTC (rev 35710)
@@ -65,9 +65,5 @@
 
 Note: publican is optional. If you can live without documentation then build with ant -Dpublican=false
 
-Although it's no longer tried and tested, it may remain possible for a time to build on Java 5 by editing
-ArjunaJTA/jdbc/build.xml and changing the excluded **/*JDBC3.java pattern
-to **/*JDBC4.java instead. This is required as the JDBC3 and 4 APIs are not compatible.
-
 A handful of unit tests build and run as part of the normal build. Most test coverage is in the form of integration
 tests which reside in the qa/ directory. These are built but not run automatically. See qa/README.txt for usage.



More information about the jboss-svn-commits mailing list