[jboss-svn-commits] JBL Code SVN: r26881 - in labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore: jdbc and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jun 9 07:18:21 EDT 2009


Author: jhalliday
Date: 2009-06-09 07:18:21 -0400 (Tue, 09 Jun 2009)
New Revision: 26881

Added:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/ibm_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/jconnect_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/microsoft_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/mysql_ab_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/postgresql_driver.java
Removed:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/apache_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/cloudscape_3_6_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_0_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_1_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_9_0_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sequelink_5_1_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sqlserver_accessor.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/apache_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_8_0_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/sqlserver_driver.java
Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCImple.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCStore.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_driver.java
Log:
Update JDBC ObjectStore support for current db drivers. JBTM-314


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCImple.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCImple.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -846,13 +846,167 @@
 		return removeOk;
 	}
 
-	public abstract InputObjectState read_state(Uid objUid, String typeName,
-			int ft, String tableName) throws ObjectStoreException;
+    /**
+     * @message com.arjuna.ats.internal.arjuna.objectstore.JDBCImple_readfailed [com.arjuna.ats.internal.arjuna.objectstore.JDBCImple_readfailed] - JDBCImple:read_state failed
+     */
+	public InputObjectState read_state (Uid objUid, String tName, int ft, String tableName) throws ObjectStoreException
+	{
+		InputObjectState newImage = null;
 
-	public abstract boolean write_state(Uid objUid, String typeName,
-			OutputObjectState state, int s, String tableName)
-			throws ObjectStoreException;
+		if (!storeValid())
+			return newImage;
 
+		if (tName != null)
+		{
+			if ((ft == ObjectStore.OS_COMMITTED) || (ft == ObjectStore.OS_UNCOMMITTED))
+			{
+				int pool = getPool();
+				ResultSet rs = null;
+
+				try
+				{
+					PreparedStatement pstmt = _preparedStatements[pool][READ_STATE];
+
+					if (pstmt == null)
+					{
+						pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND TypeName = ? AND StateType = ?");
+
+						_preparedStatements[pool][READ_STATE] = pstmt;
+					}
+
+					pstmt.setString(1, objUid.stringForm());
+					pstmt.setString(2, tName);
+					pstmt.setInt(3, ft);
+
+					rs = pstmt.executeQuery();
+
+					if(! rs.next()) {
+						return null; // no matching state in db
+					}
+
+					byte[] buffer = rs.getBytes(1);
+
+					if (buffer != null)
+					{
+						newImage = new InputObjectState(objUid, tName, buffer);
+					}
+					else {
+					    if (tsLogger.arjLoggerI18N.isWarnEnabled())
+						tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.JDBCImple_readfailed");
+					}
+				}
+				catch (Throwable e)
+				{
+					if(retryConnection(e, pool)) {
+						return read_state(objUid, tName, ft, tableName);
+					} else {
+						throw new ObjectStoreException(e.toString(), e);
+					}
+				}
+				finally
+				{
+					try
+					{
+						rs.close();
+					}
+					// Ignore
+					catch (Exception re) {}
+					freePool(pool);
+				}
+			}
+		}
+		else
+			throw new ObjectStoreException("JDBCImple.read_state - object with uid "+objUid+" has no TypeName");
+
+		return newImage;
+	}
+
+
+    /**
+     * @message com.arjuna.ats.internal.arjuna.objectstore.JDBCImple_writefailed [com.arjuna.ats.internal.arjuna.objectstore.JDBCImple_writefailed] - JDBCImple:write_state caught exception: {0}
+     */
+    public boolean write_state (Uid objUid, String tName, OutputObjectState state, int s, String tableName) throws ObjectStoreException
+	{
+		boolean result = false;
+
+		int imageSize = (int) state.length();
+
+		if (imageSize > getMaxStateSize())
+			throw new ObjectStoreException("Object state is too large - maximum size allowed: " + getMaxStateSize());
+
+		byte[] b = state.buffer();
+
+		if (imageSize > 0 && storeValid())
+		{
+			int pool = getPool();
+			ResultSet rs = null;
+
+			try
+			{
+				PreparedStatement pstmt = _preparedStatements[pool][READ_WRITE_SHORTCUT];
+
+				if (pstmt == null)
+				{
+					pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND StateType = ? AND TypeName = ?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+
+					_preparedStatements[pool][READ_WRITE_SHORTCUT] = pstmt;
+				}
+
+				pstmt.setString(1, objUid.stringForm());
+				pstmt.setInt(2, s);
+				pstmt.setString(3, tName);
+
+				rs = pstmt.executeQuery();
+
+				if( rs.next() ) {
+
+					rs.updateBytes(1, b);
+					rs.updateRow();
+
+				} else {
+					// not in database, do insert:
+					PreparedStatement pstmt2 = _preparedStatements[pool][WRITE_STATE_NEW];
+
+					if (pstmt2 == null)
+					{
+						pstmt2 = _theConnection[pool].prepareStatement("INSERT INTO "+tableName+" (StateType,TypeName,UidString,ObjectState) VALUES (?,?,?,?)");
+
+						_preparedStatements[pool][WRITE_STATE_NEW] = pstmt2;
+					}
+
+					pstmt2.setInt(1, s);
+					pstmt2.setString(2, tName);
+					pstmt2.setString(3, objUid.stringForm());
+					pstmt2.setBytes(4, b);
+
+					pstmt2.executeUpdate();
+				}
+
+				result = true;
+			}
+			catch(Throwable e)
+			{
+				if(retryConnection(e, pool)) {
+					return write_state(objUid, tName, state, s, tableName);
+				} else {
+				    if (tsLogger.arjLoggerI18N.isWarnEnabled())
+					tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.JDBCImple_writefailed", new Object[] {e});
+				}
+			}
+			finally
+			{
+				try
+				{
+					rs.close();
+				}
+				// Ignore
+				catch (Exception re) {}
+				freePool(pool);
+			}
+		}
+		return result;
+	}
+
 	/**
 	 * Set up the store for use.
 	 *
@@ -942,6 +1096,7 @@
 		_jdbcAccess = jdbcAccess;
 		_theConnection = new Connection[_poolSizeMax];
 		_theConnection[0] = conn;
+        conn.setAutoCommit(true);
 
 		try
 		{
@@ -1066,6 +1221,8 @@
 
 	public abstract String name();
 
+    protected abstract int getMaxStateSize();
+
 	// protected abstract boolean exists (String state);
 
 	/**

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCStore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCStore.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCStore.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -843,6 +843,8 @@
 		if (index != -1)
 			name = name.substring(0, index);
 
+        name = name.replaceAll("-", "_");
+
 		name = name.toLowerCase();
 
 		final ClassLoader classLoader = Thread.currentThread()

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/apache_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/apache_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/apache_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,42 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
-* apache_accessor.java
-*
-* Copyright (c) 2004 Arjuna Technologies Ltd.
-* Arjuna Technologies Ltd. Confidential
-*
-* Created on 16-Mar-2005,15:34:11 by Arnaud Simon
-*
-* $Id: apache_accessor.java 2342 2006-03-30 13:06:17Z  $
-*/
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-/**
- * Not sure what it is used for but I just created it to keep using the same pattern.
- *
- * @author Arnaud Simon <Arnaud.Simon at arjuna.com>
- * @version $Id: apache_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-public class apache_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/cloudscape_3_6_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/cloudscape_3_6_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/cloudscape_3_6_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: cloudscape_3_6_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import java.sql.SQLException;
-
-public class cloudscape_3_6_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_0_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_0_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_0_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,41 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: oracle_8_0_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import com.arjuna.ats.arjuna.exceptions.FatalError;
-import java.sql.SQLException;
-
-public class oracle_8_0_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_1_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_1_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_8_1_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: oracle_8_1_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import java.sql.SQLException;
-
-public class oracle_8_1_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_9_0_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_9_0_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_9_0_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,41 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: oracle_9_0_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import com.arjuna.ats.arjuna.exceptions.FatalError;
-import java.sql.SQLException;
-
-public class oracle_9_0_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/oracle_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,41 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: oracle_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import com.arjuna.ats.arjuna.exceptions.FatalError;
-import java.sql.SQLException;
-
-public class oracle_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sequelink_5_1_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sequelink_5_1_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sequelink_5_1_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,41 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: sequelink_5_1_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import com.arjuna.ats.arjuna.exceptions.FatalError;
-import java.sql.SQLException;
-
-public class sequelink_5_1_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sqlserver_accessor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sqlserver_accessor.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/accessors/sqlserver_accessor.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,41 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: sqlserver_accessor.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors;
-
-import java.sql.Connection;
-
-import com.arjuna.ats.arjuna.exceptions.FatalError;
-import java.sql.SQLException;
-
-public class sqlserver_accessor extends accessor
-{
-}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/apache_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/apache_driver.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/apache_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,208 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
-* apache_driver.java
-*
-* Copyright (c) 2004 Arjuna Technologies Ltd.
-* Arjuna Technologies Ltd. Confidential
-*
-* Created on 25-Feb-2005,13:02:10 by Arnaud Simon
-*
-* $Id: apache_driver.java 2342 2006-03-30 13:06:17Z  $
-*/
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
-
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-import com.arjuna.ats.arjuna.state.InputObjectState;
-import com.arjuna.ats.arjuna.state.OutputObjectState;
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.ats.arjuna.logging.tsLogger;
-
-import java.sql.*;
-/**
- * An object store implementation for Derby which uses a JDBC database for
- * maintaining object states. All states are maintained within a
- * single table.
- *
- * @author Arnaud Simon <Arnaud.Simon at arjuna.com>
- * @version $Id: apache_driver.java 2342 2006-03-30 13:06:17Z  $
- */
-
-public class apache_driver extends JDBCImple
-{
-    public InputObjectState read_state (Uid objUid, String tName, int ft, String tableName) throws ObjectStoreException
-    {
-        InputObjectState newImage = null;
-
-        if (!storeValid())
-            return newImage;
-
-        if (tName != null)
-        {
-            if ((ft == ObjectStore.OS_COMMITTED) || (ft == ObjectStore.OS_UNCOMMITTED))
-            {
-                int pool = getPool();
-                ResultSet rs = null;
-                try
-                {
-                    PreparedStatement pstmt = _preparedStatements[pool][READ_STATE];
-                    if (pstmt == null)
-                    {
-                        pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND TypeName = ? AND StateType = ?");
-                        _preparedStatements[pool][READ_STATE] = pstmt;
-                    }
-
-                    pstmt.setString(1, objUid.stringForm());
-                    pstmt.setString(2, tName);
-                    pstmt.setInt(3, ft);
-
-                    rs = pstmt.executeQuery();
-
-                    if(! rs.next()) {
-                        return null; // no matching state in db
-                    }
-                    Blob myBlob = (Blob)rs.getBlob(1);
-                    byte[] buffer = myBlob.getBytes(1, (int)myBlob.length());
-
-                    if (buffer != null)
-                    {
-                        newImage = new InputObjectState(objUid, tName, buffer);
-                    }
-                    else {
-                        if (tsLogger.arjLoggerI18N.isWarnEnabled())
-                            tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_1");
-                    }
-                }
-                catch (Throwable e)
-                {
-                    if(retryConnection(e, pool)) {
-                        return read_state(objUid, tName, ft, tableName);
-                    } else {
-                        throw new ObjectStoreException(e.toString(), e);
-                    }
-                }
-                finally
-                {
-                    try
-                    {
-                        if (rs != null)
-                            rs.close();
-                    }
-                            // Ignore
-                    catch (Exception re) {}
-                    freePool(pool);
-                }
-            }
-        }
-        else
-            throw new ObjectStoreException("oracle.read_state - object with uid "+objUid+" has no TypeName");
-
-        return newImage;
-    }
-
-
-    public boolean write_state (Uid objUid, String tName, OutputObjectState state, int s, String tableName) throws ObjectStoreException
-    {
-        boolean result = false;
-        int imageSize = (int) state.length();
-        if (imageSize > _maxStateSize)
-            throw new ObjectStoreException("Object state is too large - maximum size allowed: " + _maxStateSize);
-        byte[] b = state.buffer();
-        if (imageSize > 0 && storeValid())
-        {
-            int pool = getPool();
-            try
-            {
-                PreparedStatement pstmt = _preparedStatements[pool][READ_WRITE_SHORTCUT];
-                if (pstmt == null)
-                {
-                    pstmt = _theConnection[pool].prepareStatement("UPDATE "+tableName+" SET ObjectState = ? WHERE UidString = ? AND StateType = ?");
-                    _preparedStatements[pool][READ_WRITE_SHORTCUT] = pstmt;
-                }
-                pstmt.setBytes(1, b);
-                pstmt.setString(2, objUid.stringForm());
-                pstmt.setInt(3, s);
-                int rowcount =  pstmt.executeUpdate();
-                if( rowcount > 0 )
-                {
-                    // update worked, we are done.
-                }
-                else
-                {
-                    // not in database, do insert:
-                    PreparedStatement pstmt2 = _preparedStatements[pool][WRITE_STATE_NEW];
-                    if (pstmt2 == null)
-                    {
-                        pstmt2 = _theConnection[pool].prepareStatement("INSERT INTO "+tableName+" (StateType,TypeName,UidString,ObjectState) VALUES (?,?,?,?)");
-                        _preparedStatements[pool][WRITE_STATE_NEW] = pstmt2;
-                    }
-                    pstmt2.setInt(1, s);
-                    pstmt2.setString(2, tName);
-                    pstmt2.setString(3, objUid.stringForm());
-                    pstmt2.setBytes(4, b);
-                    pstmt2.executeUpdate();
-                }
-                result = true;
-            }
-            catch(Throwable e)
-            {
-                if(retryConnection(e, pool))
-                {
-                    return write_state(objUid, tName, state, s, tableName);
-                } else
-                {
-                    if (tsLogger.arjLoggerI18N.isWarnEnabled())
-                        tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_2", new Object[] {e});
-                }
-            }
-            finally
-            {
-                try
-                {
-                    _theConnection[pool].setAutoCommit(true);
-                }
-                catch(Exception e) {}
-                freePool(pool);
-            }
-        }
-        return result;
-    }
-
-
-    protected void createTable (Statement stmt, String tableName) throws SQLException
-    {
-        //stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(1024),UidString VARCHAR(255), ObjectState BLOB, CONSTRAINT "+tableName+"_pk PRIMARY KEY(UidString, StateType, TypeName))");
-        stmt.executeUpdate("CREATE TABLE " + tableName + " (StateType INTEGER NOT NULL, TypeName VARCHAR(1024), UidString VARCHAR(255) NOT NULL, ObjectState BLOB, PRIMARY KEY(UidString, StateType))");
-
-    }
-
-    public String name ()
-    {
-        return "apache";
-    }
-
-    // private static final int  _maxStateSize = 65535;
-    // Oracle BLOBs should be OK up to > 4 GB, but cap @ 10 MB for testing:
-    private static final int _maxStateSize = 1024 * 1024 * 10;
-
-}

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/ibm_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/ibm_driver.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/ibm_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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) 2009,
+ * @author JBoss by Red Hat.
+ */
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+
+import java.sql.Statement;
+import java.sql.SQLException;
+
+/**
+ * JDBC store implementation driver-specific code.
+ * This version for IBM DB2 Universal JDBC Drivers.
+ */
+public class ibm_driver extends JDBCImple
+{
+    protected void createTable (Statement stmt, String tableName) throws SQLException
+	{
+		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER NOT NULL, TypeName VARCHAR(255) NOT NULL, UidString VARCHAR(255) NOT NULL, ObjectState BLOB" +", PRIMARY KEY(UidString, StateType, TypeName))");
+	}
+
+	public String name ()
+	{
+		return "ibm db2";
+	}
+
+    protected int getMaxStateSize()
+    {
+        return 65535;
+    }
+}

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/jconnect_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/jconnect_driver.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/jconnect_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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) 2009,
+ * @author JBoss by Red Hat.
+ */
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+
+import java.sql.Statement;
+import java.sql.SQLException;
+
+/**
+ * JDBC store implementation driver-specific code.
+ * This version for Sybase jConnect 6 JDBC Drivers.
+ */
+public class jconnect_driver extends JDBCImple
+{
+    protected void createTable (Statement stmt, String tableName) throws SQLException
+	{
+		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER NOT NULL, TypeName VARCHAR(255) NOT NULL, UidString VARCHAR(255) NOT NULL, ObjectState IMAGE" +", PRIMARY KEY(UidString, StateType, TypeName))");
+	}
+
+	public String name ()
+	{
+		return "sybase";
+	}
+
+    protected int getMaxStateSize() {
+        return 65535;
+    }
+}

Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/microsoft_driver.java (from rev 26867, labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/sqlserver_driver.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/microsoft_driver.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/microsoft_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -0,0 +1,73 @@
+/*
+ * 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * $Id: microsoft_driver.java 2342 2006-03-30 13:06:17Z  $
+ *
+ * Copyright (c) 2001 Hewlett-Packard Company
+ * Hewlett-Packard Company Confidential
+ * Copyright (c) 2004 Arjuna Technologies Limited
+ *
+ * $Project: ArjunaCore$
+ * $Revision: 2342 $
+ * $Date: 2006-03-30 14:06:17 +0100 (Thu, 30 Mar 2006) $
+ * $Author: $
+ */
+
+/*
+ * Note: This impl has come from HP-TS-2.2 via. HP-MS 1.0
+ */
+
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+
+/**
+ * JDBC store implementation driver-specific code.
+ * This version for MS SQL Server JDBC Drivers 2 (server 2005/2008).
+ */
+public class microsoft_driver extends JDBCImple
+{
+	protected void createTable (Statement stmt, String tableName) throws SQLException
+	{
+		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(1024), UidString VARCHAR(255), ObjectState VARBINARY(MAX), PRIMARY KEY(UidString, StateType, TypeName))");
+	}
+
+	public String name ()
+	{
+		return "mssqlserver";
+	}
+
+    protected int getMaxStateSize()
+    {
+        return 65535;
+    }
+}

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/mysql_ab_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/mysql_ab_driver.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/mysql_ab_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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) 2009,
+ * @author JBoss by Red Hat.
+ */
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+
+import java.sql.Statement;
+import java.sql.SQLException;
+
+/**
+ * JDBC store implementation driver-specific code.
+ * This version for MySQL JDBC Drivers.
+ */
+public class mysql_ab_driver extends JDBCImple
+{
+    protected void createTable (Statement stmt, String tableName) throws SQLException
+	{
+		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(255), UidString VARCHAR(255), ObjectState BLOB, PRIMARY KEY(UidString, StateType, TypeName))");
+	}
+
+	public String name ()
+	{
+		return "mysql";
+	}
+
+    protected int getMaxStateSize()
+    {
+        return 65535;
+    }
+}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_8_0_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_8_0_driver.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_8_0_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,244 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * $Id: oracle_8_0_driver.java 2342 2006-03-30 13:06:17Z  $
- *
- * Copyright (c) 2001 Hewlett-Packard Company
- * Hewlett-Packard Company Confidential
- *
- * $Project: ArjunaCore$
- * $Revision: 2342 $
- * $Date: 2006-03-30 14:06:17 +0100 (Thu, 30 Mar 2006) $
- * $Author: $
- */
-
-/*
- * JDBC store implementations are driver specific.
- * This version for Oracle 8.0 JDBC Drivers (OCI or Thin) ONLY.
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
-
-import java.io.IOException;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.state.InputBuffer;
-import com.arjuna.ats.arjuna.state.InputObjectState;
-import com.arjuna.ats.arjuna.state.OutputBuffer;
-import com.arjuna.ats.arjuna.state.OutputObjectState;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.ats.arjuna.objectstore.ObjectStoreImple;
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-
-/**
- * An object store implementation which uses a JDBC database for
- * maintaining object states. All states are maintained within a
- * single table.
- *
- * @message com.arjuna.ats.internal.arjuna.objectstore.drivers.oracle_8_0_1 [com.arjuna.ats.internal.arjuna.objectstore.drivers.oracle_8_0_8] - oracle_8_0.read_state failed
- * @message com.arjuna.ats.internal.arjuna.objectstore.drivers.oracle_8_0_2 [com.arjuna.ats.internal.arjuna.objectstore.drivers.oracle_8_0_2] - oracle_8_0.write_state caught exception: {0}
- */
-
-public class oracle_8_0_driver extends JDBCImple
-{
-	public InputObjectState read_state (Uid objUid, String tName, int ft, String tableName) throws ObjectStoreException
-	{
-		InputObjectState newImage = null;
-
-		if (!storeValid())
-			return newImage;
-
-		if (tName != null)
-		{
-			if ((ft == ObjectStore.OS_COMMITTED) || (ft == ObjectStore.OS_UNCOMMITTED))
-			{
-				int pool = getPool();
-				ResultSet rs = null;
-
-				try
-				{
-					PreparedStatement pstmt = _preparedStatements[pool][READ_STATE];
-
-					if (pstmt == null)
-					{
-						pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND TypeName = ? AND StateType = ?");
-
-						_preparedStatements[pool][READ_STATE] = pstmt;
-					}
-
-					pstmt.setString(1, objUid.stringForm());
-					pstmt.setString(2, tName);
-					pstmt.setInt(3, ft);
-
-					rs = pstmt.executeQuery();
-
-					if( ! rs.next()) {
-						return null; // no matching state in db
-					}
-
-					byte[] buffer = rs.getBytes(1);
-
-					rs.close();
-
-					if (buffer != null)
-					{
-						newImage = new InputObjectState(objUid, tName, buffer);
-					}
-					else {
-					    tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.drivers.oracle_8_0_1");
-                    }
-				}
-				catch (Exception e)
-				{
-					throw new ObjectStoreException(e.toString(), e);
-				}
-				finally
-				{
-					try
-					{
-						rs.close();
-					}
-					// Ignore
-					catch (Exception re) {}
-					freePool(pool);
-				}
-			}
-		}
-		else
-			throw new ObjectStoreException("oracle_8_0.read_state - object with uid "+objUid+" has no TypeName");
-
-		return newImage;
-	}
-
-
-	public boolean write_state (Uid objUid, String tName, OutputObjectState state, int s, String tableName) throws ObjectStoreException
-	{
-		boolean result = false;
-
-		int imageSize = (int) state.length();
-
-		if (imageSize > _maxStateSize)
-			throw new ObjectStoreException("Object state is too large - maximum size allowed: " + _maxStateSize);
-
-		byte[] b = state.buffer();
-
-		if (imageSize > 0 && storeValid())
-		{
-			int pool = getPool();
-			ResultSet rs = null;
-
-			try
-			{
-
-				PreparedStatement pstmt = _preparedStatements[pool][READ_WRITE_SHORTCUT];
-
-				_theConnection[pool].setAutoCommit(false);
-
-				if (pstmt == null)
-				{
-					pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND StateType = ? AND TypeName = ? FOR UPDATE", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
-					_preparedStatements[pool][READ_WRITE_SHORTCUT] = pstmt;
-				}
-
-				pstmt.setString(1, objUid.stringForm());
-				pstmt.setInt(2, s);
-				pstmt.setString(3, tName);
-
-				rs = pstmt.executeQuery();
-
-				if( rs.next() ) {
-
-					rs.updateBytes(1, b);
-					rs.updateRow();
-
-				} else {
-
-					// not in database, do insert:
-					PreparedStatement pstmt2 = _preparedStatements[pool][WRITE_STATE_NEW];
-
-					if (pstmt2 == null)
-					{
-						pstmt2 = _theConnection[pool].prepareStatement("INSERT INTO "+tableName+" (StateType,TypeName,UidString,ObjectState) VALUES (?,?,?,?)");
-
-						_preparedStatements[pool][WRITE_STATE_NEW] = pstmt2;
-					}
-
-					pstmt2.setInt(1, s);
-					pstmt2.setString(2, tName);
-					pstmt2.setString(3, objUid.stringForm());
-					pstmt2.setBytes(4, b);
-
-					pstmt2.executeUpdate();
-					_theConnection[pool].commit();
-				}
-
-				rs.close();
-				_theConnection[pool].commit();
-				result = true;
-
-			}
-			catch(Exception e)
-			{
-			    tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.drivers.oracle_8_0_2", new Object[] {e});
-			}
-			finally
-			{
-				try
-				{
-					_theConnection[pool].setAutoCommit(true);
-				}
-				catch(Exception e) {}
-				try
-				{
-					rs.close();
-				}
-				// Ignore
-				catch (Exception re) {}
-				freePool(pool);
-			}
-		}
-		return result;
-	}
-
-	protected void createTable (Statement stmt, String tableName) throws SQLException
-	{
-		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(1024), UidString VARCHAR(255), ObjectState "+blobName+", PRIMARY KEY(UidString, StateType, TypeName))");
-	}
-
-	public String name ()
-	{
-		return "oracle_8_0";
-	}
-
-	private static final int  _maxStateSize = 65535;
-	private String blobName = "BLOB";
-
-
-}

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_driver.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -55,8 +55,6 @@
 import com.arjuna.ats.arjuna.logging.tsLogger;
 import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
 
-import oracle.sql.BLOB;
-
 /**
  * @message com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_1 [com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_1] - oracle:read_state failed
  * @message com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_2 [com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_2] - oracle:write_state caught exception: {0}
@@ -159,8 +157,8 @@
 	{
 		int imageSize = (int) state.length();
 
-		if (imageSize > _maxStateSize)
-			throw new ObjectStoreException("Object state is too large - maximum size allowed: " + _maxStateSize);
+		if (imageSize > getMaxStateSize())
+			throw new ObjectStoreException("Object state is too large - maximum size allowed: " + getMaxStateSize());
 
 		byte[] b = state.buffer();
 
@@ -193,8 +191,8 @@
 
         				if( rs.next() ) {
 
-        					BLOB myBlob = (BLOB)rs.getBlob(1);
-        					myBlob.putBytes(1, b);
+        					Blob myBlob = rs.getBlob(1);
+        					myBlob.setBytes(1, b);
 
         				} else {
         					// not in database, do insert:
@@ -226,8 +224,8 @@
 
         					rs3 = pstmt3.executeQuery();
         					rs3.next();
-        					BLOB myBlob = (BLOB)rs3.getBlob(1);
-        					myBlob.putBytes(1, b);
+        					Blob myBlob = rs3.getBlob(1);
+        					myBlob.setBytes(1, b);
         				}
 
         				_theConnection[pool].commit();
@@ -283,7 +281,6 @@
 		return false ;
 	}
 
-
 	protected void createTable (Statement stmt, String tableName) throws SQLException
 	{
 		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(1024),UidString VARCHAR(255), ObjectState BLOB, CONSTRAINT "+tableName+"_pk PRIMARY KEY(UidString, StateType, TypeName))");
@@ -294,8 +291,9 @@
 		return "oracle";
 	}
 
-	// private static final int  _maxStateSize = 65535;
-	// Oracle BLOBs should be OK up to > 4 GB, but cap @ 10 MB for testing:
-	private static final int _maxStateSize = 1024 * 1024 * 10;
-
+    protected int getMaxStateSize()
+    {
+        // Oracle BLOBs should be OK up to > 4 GB, but cap @ 10 MB for testing/performance:
+        return 1024 * 1024 * 10;
+    }
 }

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/postgresql_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/postgresql_driver.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/postgresql_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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) 2009,
+ * @author JBoss by Red Hat.
+ */
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+
+import java.sql.Statement;
+import java.sql.SQLException;
+
+/**
+ * JDBC store implementation driver-specific code.
+ * This version for PostgreSQL JDBC Drivers.
+ */
+public class postgresql_driver extends JDBCImple
+{
+    protected void createTable (Statement stmt, String tableName) throws SQLException
+	{
+		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(1024), UidString VARCHAR(255), ObjectState bytea, PRIMARY KEY(UidString, StateType, TypeName))");
+	}
+
+	public String name ()
+	{
+		return "pgsql";
+	}
+
+    protected int getMaxStateSize()
+    {
+        return 65535;
+    }
+}

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/sqlserver_driver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/sqlserver_driver.java	2009-06-09 10:14:24 UTC (rev 26880)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/sqlserver_driver.java	2009-06-09 11:18:21 UTC (rev 26881)
@@ -1,240 +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) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * $Id: sqlserver_driver.java 2342 2006-03-30 13:06:17Z  $
- *
- * Copyright (c) 2001 Hewlett-Packard Company
- * Hewlett-Packard Company Confidential
- * Copyright (c) 2004 Arjuna Technologies Limited
- *
- * $Project: ArjunaCore$
- * $Revision: 2342 $
- * $Date: 2006-03-30 14:06:17 +0100 (Thu, 30 Mar 2006) $
- * $Author: $
- */
-
-/*
- * Note: This impl has come from HP-TS-2.2 via. HP-MS 1.0
- */
-
-/*
- * JDBC store implementation driver-specific code.
- * This version for MS SQL Server JDBC Drivers.
- */
-package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
-
-import java.io.IOException;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.state.InputObjectState;
-import com.arjuna.ats.arjuna.state.OutputObjectState;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-
-/**
- * @message com.arjuna.ats.internal.arjuna.objectstore.jdbc.sqlserver_1 [com.arjuna.ats.internal.arjuna.objectstore.jdbc.sqlserver_1] - sqlserver:read_state failed
- * @message com.arjuna.ats.internal.arjuna.objectstore.jdbc.sqlserver_2 [com.arjuna.ats.internal.arjuna.objectstore.jdbc.sqlserver_2] - sqlserver:write_state caught exception: {0}
- */
-
-public class sqlserver_driver extends JDBCImple
-{
-	public InputObjectState read_state (Uid objUid, String tName, int ft, String tableName) throws ObjectStoreException
-	{
-		InputObjectState newImage = null;
-
-		if (!storeValid())
-			return newImage;
-
-		if (tName != null)
-		{
-			if ((ft == ObjectStore.OS_COMMITTED) || (ft == ObjectStore.OS_UNCOMMITTED))
-			{
-				int pool = getPool();
-				ResultSet rs = null;
-
-				try
-				{
-					PreparedStatement pstmt = _preparedStatements[pool][READ_STATE];
-
-					if (pstmt == null)
-					{
-						pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND TypeName = ? AND StateType = ?");
-
-						_preparedStatements[pool][READ_STATE] = pstmt;
-					}
-
-					pstmt.setString(1, objUid.stringForm());
-					pstmt.setString(2, tName);
-					pstmt.setInt(3, ft);
-
-					rs = pstmt.executeQuery();
-
-					if(! rs.next()) {
-						return null; // no matching state in db
-					}
-
-					byte[] buffer = rs.getBytes(1);
-
-					if (buffer != null)
-					{
-						newImage = new InputObjectState(objUid, tName, buffer);
-					}
-					else {
-					    if (tsLogger.arjLoggerI18N.isWarnEnabled())
-						tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.jdbc.sqlserver_1");
-					}
-				}
-				catch (Throwable e)
-				{
-					if(retryConnection(e, pool)) {
-						return read_state(objUid, tName, ft, tableName);
-					} else {
-						throw new ObjectStoreException(e.toString(), e);
-					}
-				}
-				finally
-				{
-					try
-					{
-						rs.close();
-					}
-					// Ignore
-					catch (Exception re) {}
-					freePool(pool);
-				}
-			}
-		}
-		else
-			throw new ObjectStoreException("sqlserver.read_state - object with uid "+objUid+" has no TypeName");
-
-		return newImage;
-	}
-
-
-	public boolean write_state (Uid objUid, String tName, OutputObjectState state, int s, String tableName) throws ObjectStoreException
-	{
-		boolean result = false;
-
-		int imageSize = (int) state.length();
-
-		if (imageSize > _maxStateSize)
-			throw new ObjectStoreException("Object state is too large - maximum size allowed: " + _maxStateSize);
-
-		byte[] b = state.buffer();
-
-		if (imageSize > 0 && storeValid())
-		{
-			int pool = getPool();
-			ResultSet rs = null;
-
-			try
-			{
-				PreparedStatement pstmt = _preparedStatements[pool][READ_WRITE_SHORTCUT];
-
-				if (pstmt == null)
-				{
-					pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND StateType = ? AND TypeName = ?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
-
-					_preparedStatements[pool][READ_WRITE_SHORTCUT] = pstmt;
-				}
-
-				pstmt.setString(1, objUid.stringForm());
-				pstmt.setInt(2, s);
-				pstmt.setString(3, tName);
-
-				rs = pstmt.executeQuery();
-
-				if( rs.next() ) {
-
-					rs.updateBytes(1, b);
-					rs.updateRow();
-
-				} else {
-					// not in database, do insert:
-					PreparedStatement pstmt2 = _preparedStatements[pool][WRITE_STATE_NEW];
-
-					if (pstmt2 == null)
-					{
-						pstmt2 = _theConnection[pool].prepareStatement("INSERT INTO "+tableName+" (StateType,TypeName,UidString,ObjectState) VALUES (?,?,?,?)");
-
-						_preparedStatements[pool][WRITE_STATE_NEW] = pstmt2;
-					}
-
-					pstmt2.setInt(1, s);
-					pstmt2.setString(2, tName);
-					pstmt2.setString(3, objUid.stringForm());
-					pstmt2.setBytes(4, b);
-
-					pstmt2.executeUpdate();
-					_theConnection[pool].commit();
-
-				}
-
-				_theConnection[pool].commit();
-				result = true;
-
-			}
-			catch(Throwable e)
-			{
-				if(retryConnection(e, pool)) {
-					return write_state(objUid, tName, state, s, tableName);
-				} else {
-				    if (tsLogger.arjLoggerI18N.isWarnEnabled())
-					tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.jdbc.sqlserver_2", new Object[] {e});
-				}
-			}
-			finally
-			{
-				try
-				{
-					rs.close();
-				}
-				// Ignore
-				catch (Exception re) {}
-				freePool(pool);
-			}
-		}
-		return result;
-	}
-
-
-	protected void createTable (Statement stmt, String tableName) throws SQLException
-	{
-		stmt.executeUpdate("CREATE TABLE "+tableName+" (StateType INTEGER, TypeName VARCHAR(1024), UidString VARCHAR(255), ObjectState IMAGE, PRIMARY KEY(UidString, StateType, TypeName))");
-
-	}
-
-	public String name ()
-	{
-		return "sqlserver";
-	}
-
-	private static final int  _maxStateSize = 65535;
-
-}




More information about the jboss-svn-commits mailing list