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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 9 10:28:10 EDT 2010


Author: jhalliday
Date: 2010-09-09 10:28:08 -0400 (Thu, 09 Sep 2010)
New Revision: 35091

Added:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCActionStore.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCImple.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStore.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBean.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBeanMBean.java
Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBean.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBeanMBean.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/StoreManager.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java
   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/oracle_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/postgresql_driver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/JDBCObjectStoreTest.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockDriver.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockOracleDriver.java
   labs/jbosstm/trunk/qa/tests/product/src/com/arjuna/ats/tools/perftest/product/JBossTSProduct.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/EmptyObjectStore.java
Log:
Split JDBC ObjectStore properties from file system based ones, change store init code to support use of different env bean types. JBTM-788


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBean.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBean.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -42,12 +42,6 @@
     private volatile String objectStoreType = ShadowNoFileLockStore.class.getName();
     private volatile int hashedDirectories = HashedStore.DEFAULT_NUMBER_DIRECTORIES;
     private volatile boolean transactionSync = true;
-    
-    private volatile String jdbcUserDbAccess = null;
-    private volatile String jdbcTxDbAccess = null;
-    private volatile int jdbcPoolSizeInitial = 1;
-    private volatile int jdbcPoolSizeMaximum = 1;
-    private volatile boolean jdbcPoolPutConnections = false;
 
     private volatile int share = StateType.OS_UNSHARED;
     private volatile int hierarchyRetry = 100;
@@ -358,122 +352,6 @@
     }
 
     /**
-     * Returns the classname of the JDBCAccess implementation used for the ObjectStore.
-     *
-     * Default: null
-     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcUserDbAccess
-     *
-     * @return the name of a class implementing JDBCAccess.
-     */
-    public String getJdbcUserDbAccess()
-    {
-        return jdbcUserDbAccess;
-    }
-
-    /**
-     * Sets the classname of the JDBCAccess implementation used for the ObjectStore.
-     *
-     * @param jdbcUserDbAccess the name of the class implementing JDBCAccess.
-     */
-    public void setJdbcUserDbAccess(String jdbcUserDbAccess)
-    {
-        this.jdbcUserDbAccess = jdbcUserDbAccess;
-    }
-
-    /**
-     * Returns the classname of the JDBCAccess implementation used for the ActionStore.
-     *
-     * Default: null
-     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcTxDbAccess
-     *
-     * @return the name of a class implementing JDBCAccess.
-     */
-    public String getJdbcTxDbAccess()
-    {
-        return jdbcTxDbAccess;
-    }
-
-    /**
-     * Sets the classname of the JDBCAccess implementation used for the ActionStore.
-     *
-     * @param jdbcTxDbAccess the name of the class implementing JDBCAccess.
-     */
-    public void setJdbcTxDbAccess(String jdbcTxDbAccess)
-    {
-        this.jdbcTxDbAccess = jdbcTxDbAccess;
-    }
-
-    /**
-     * Returns the number of connections to initialize in the pool at startup.
-     *
-     * Default: 1
-     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeInitial
-     *
-     * @return the initial size of the connection pool.
-     */
-    public int getJdbcPoolSizeInitial()
-    {
-        return jdbcPoolSizeInitial;
-    }
-
-    /**
-     * Sets the number of the connection to initialize in the pool at startup.
-     *
-     * @param jdbcPoolSizeInitial the initial size of the connection pool.
-     */
-    public void setJdbcPoolSizeInitial(int jdbcPoolSizeInitial)
-    {
-        this.jdbcPoolSizeInitial = jdbcPoolSizeInitial;
-    }
-
-    /**
-     * Returns the maximum number of connections to hold in the pool.
-     *
-     * Default: 1
-     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeMaximum"
-     *
-     * @return the maximum size of the connection pool.
-     */
-    public int getJdbcPoolSizeMaximum()
-    {
-        return jdbcPoolSizeMaximum;
-    }
-
-    /**
-     * Sets the maximum number of connections to hold in the pool.
-     *
-     * @param jdbcPoolSizeMaximum the maximum size of the connection pool.
-     */
-    public void setJdbcPoolSizeMaximum(int jdbcPoolSizeMaximum)
-    {
-        this.jdbcPoolSizeMaximum = jdbcPoolSizeMaximum;
-    }
-
-    /**
-     * Returns if connections should be returned to the pool after use.
-     *
-     * Default: false
-     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcPoolPutConnections
-     *
-     * @deprecated I'm unused and should be removed.
-     * @return true if connections should be reused, false otherwise.
-     */
-    public boolean isJdbcPoolPutConnections()
-    {
-        return jdbcPoolPutConnections;
-    }
-
-    /**
-     * Sets if connections should be returned to the pool after use.
-     *
-     * @param jdbcPoolPutConnections true to enable connection reuse, false to disable.
-     */
-    public void setJdbcPoolPutConnections(boolean jdbcPoolPutConnections)
-    {
-        this.jdbcPoolPutConnections = jdbcPoolPutConnections;
-    }
-
-    /**
      * Returns the share mode for the ObjectStore, i.e., is this being shared
      * between VMs?
      *

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBeanMBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBeanMBean.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/ObjectStoreEnvironmentBeanMBean.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -51,16 +51,6 @@
 
     boolean isTransactionSync();
 
-    String getJdbcUserDbAccess();
-
-    String getJdbcTxDbAccess();
-
-    int getJdbcPoolSizeInitial();
-
-    int getJdbcPoolSizeMaximum();
-
-    boolean isJdbcPoolPutConnections();
-
     int getShare();
 
     int getHierarchyRetry();

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/StoreManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/StoreManager.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/StoreManager.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -138,7 +138,7 @@
 
         try
         {
-            store = ClassloadingUtility.loadAndInstantiateClass(ObjectStoreAPI.class, storeType, new Object[] {storeEnvBean});
+            store = ClassloadingUtility.loadAndInstantiateClass(ObjectStoreAPI.class, storeType, name);
         }
         catch (final Throwable ex)
         {

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -21,6 +21,7 @@
 package com.arjuna.ats.internal.arjuna.common;
 
 import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.common.internal.util.propertyservice.BeanPopulator;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -46,10 +47,11 @@
      *
      * @param iface the expected interface type.
      * @param className the name of the class to load and instantiate.
-     * @param constructorArgs optional set of arguments to pass to the class constructor. null for default ctor.
+     * @param environmentBeanInstanceName When the class ctor requires a *EnvironmentBean instance, the name of the bean.
+     *   null for default ctor or default bean instance..
      * @return an instantiate of the specified class, or null.
      */
-    public static <T> T loadAndInstantiateClass(Class<T> iface, String className, Object[] constructorArgs)
+    public static <T> T loadAndInstantiateClass(Class<T> iface, String className, String environmentBeanInstanceName)
     {
         if (tsLogger.logger.isTraceEnabled()) {
             tsLogger.logger.trace("Loading class " + className);
@@ -74,16 +76,23 @@
 
         try {
             Class<? extends T> clazz2 = clazz.asSubclass(iface);
-            if(constructorArgs == null) {
-                instance = (T)clazz2.newInstance();
-            } else {
-                Class[] paramTypes = new Class[constructorArgs.length];
-                for(int i = 0; i < constructorArgs.length; i++) {
-                    paramTypes[i] = constructorArgs[i].getClass();
+
+            Constructor[] ctors = clazz.getConstructors();
+            Class environmentBeanClass = null;
+            for(Constructor constructor : ctors) {
+                if(constructor.getParameterTypes().length == 1 &&
+                        constructor.getParameterTypes()[0].getCanonicalName().endsWith("EnvironmentBean")) {
+                    environmentBeanClass = constructor.getParameterTypes()[0];
+                    Object envBean = BeanPopulator.getNamedInstance(environmentBeanClass, environmentBeanInstanceName);
+                    instance = (T)constructor.newInstance(envBean);
+                    break;
                 }
-                Constructor ctor = clazz2.getConstructor(paramTypes);
-                instance = (T)ctor.newInstance(constructorArgs);
             }
+            if(environmentBeanClass == null && environmentBeanInstanceName == null) {
+                // no bean ctor, try default ctor
+                instance = (T)clazz2.newInstance();
+            }
+
         } catch (ClassCastException e) {
             tsLogger.i18NLogger.warn_common_ClassloadingUtility_3(className, iface.getName(), e);
         }
@@ -91,8 +100,6 @@
             tsLogger.i18NLogger.warn_common_ClassloadingUtility_4(className, e);
         } catch (IllegalAccessException e) {
             tsLogger.i18NLogger.warn_common_ClassloadingUtility_5(className, e);
-        } catch(NoSuchMethodException e) {
-            tsLogger.i18NLogger.warn_common_ClassloadingUtility_4(className, e);
         } catch(InvocationTargetException e) {
             tsLogger.i18NLogger.warn_common_ClassloadingUtility_4(className, e);
         }

Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCActionStore.java (from rev 35087, labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/JDBCActionStore.java)
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCActionStore.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCActionStore.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -0,0 +1,195 @@
+/*
+ * 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: JDBCActionStore.java 2342 2006-03-30 13:06:17Z  $
+ */
+
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.arjuna.state.*;
+
+import com.arjuna.ats.arjuna.logging.tsLogger;
+
+import com.arjuna.ats.arjuna.objectstore.StateStatus;
+import com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess;
+import com.arjuna.ats.arjuna.common.*;
+
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+
+/**
+ * The transaction log implementation.
+*/
+
+public class JDBCActionStore extends JDBCStore
+{
+    /**
+     * The following operation commits a previous write_state operation which
+     * was made with the SHADOW StateType argument. This is achieved by
+     * renaming the shadow and removing the hidden version.
+     */
+
+    public synchronized boolean commit_state (Uid objUid,
+                                              String tName) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.commit_state(" + objUid + ", " + tName + ")");
+        }
+
+        boolean result = false;
+
+        /* Bail out if the object store is not set up */
+
+        if (!storeValid())
+            return false;
+
+        if (currentState(objUid, tName) == StateStatus.OS_COMMITTED)
+            result = true;
+    
+        return result;
+    }
+
+    public boolean hide_state (Uid u, String tn) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.hide_state(" + u + ", " + tn + ")");
+        }
+
+        return false;
+    }
+
+    public boolean reveal_state (Uid u, String tn) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.reveal_state(" + u + ", " + tn + ")");
+        }
+        
+        return false;
+    }
+
+    public InputObjectState read_committed (Uid storeUid, String tName) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.read_committed(" + storeUid + ", " + tName + ")");
+        }
+        
+        return super.read_committed(storeUid, tName);
+    }
+
+    public InputObjectState read_uncommitted (Uid u, String tn) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.read_uncommitted(" + u + ", " + tn + ")");
+        }
+        
+        return null;
+    }
+
+    public boolean remove_committed (Uid storeUid, String tName) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.remove_committed(" + storeUid + ", " + tName + ")");
+        }
+        
+        return super.remove_committed(storeUid, tName);
+    }
+
+    public boolean remove_uncommitted (Uid u, String tn) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.remove_uncommitted(" + u + ", " + tn + ")");
+        }
+        
+        return false;
+    }
+
+    public boolean write_committed (Uid storeUid, String tName, OutputObjectState state) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.write_committed(" + storeUid + ", " + tName + ")");
+        }
+        
+        return super.write_committed(storeUid, tName, state);
+    }
+
+    public boolean write_uncommitted (Uid u, String tn, OutputObjectState s) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCActionStore.write_uncommitted(" + u + ", " + tn + ", " + s + ")");
+        }
+        
+        return false;
+    }
+
+    public JDBCActionStore(JDBCStoreEnvironmentBean jdbcStoreEnvironmentBean) throws ObjectStoreException
+    {
+        super(jdbcStoreEnvironmentBean);
+
+        _txClassName = jdbcStoreEnvironmentBean.getJdbcTxDbAccess();
+    }
+
+    protected String getAccessClassName()
+    {
+        return _txClassName;
+    }
+
+    protected void setAccessClassName(String txClassName)
+    {
+        _txClassName = txClassName;
+    }
+
+    protected String getDefaultTableName()
+    {
+        return _defaultTxTableName;
+    }
+
+    protected JDBCAccess getJDBCAccess()
+    {
+        return _txJDBCAccess;
+    }
+
+    protected void setJDBCAccess(JDBCAccess jdbcAccess)
+    {
+        _txJDBCAccess = jdbcAccess ;
+    }
+
+    protected String getTableName()
+    {
+        return _txTableName;
+    }
+
+    protected void setTableName(String tableName)
+    {
+        _txTableName = tableName ;
+    }
+
+    private JDBCAccess _txJDBCAccess;
+    private String _txClassName;
+    private String _txTableName;
+    private static String _defaultTxTableName = "JBossTSTxTable";
+
+}

Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCImple.java (from rev 35087, 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/jdbc/JDBCImple.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCImple.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -0,0 +1,1277 @@
+/*
+ * 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: JDBCImple.java 2342 2006-03-30 13:06:17Z  $
+ */
+
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.arjuna.state.*;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.objectstore.StateStatus;
+import com.arjuna.ats.arjuna.objectstore.StateType;
+import com.arjuna.ats.arjuna.common.*;
+
+import com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess;
+
+import java.sql.*;
+import java.util.Hashtable;
+
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.internal.arjuna.common.UidHelper;
+
+import java.io.IOException;
+
+/**
+ * An object store implementation which uses a JDBC database for maintaining
+ * object states. All states are maintained within a single table.
+ */
+
+public abstract class JDBCImple
+{
+
+	public final boolean storeValid()
+	{
+		return _isValid;
+	}
+
+	public boolean commit_state(Uid objUid, String typeName, String tableName)
+			throws ObjectStoreException
+	{
+		boolean result = false;
+		boolean cleanup = true;
+
+		/* Bail out if the object store is not set up */
+
+		if (!storeValid())
+			return false;
+
+		if (typeName != null)
+		{
+			int currState = currentState(objUid, typeName, tableName);
+			int pool = getPool();
+
+			try
+			{
+				// remove the old committed state, if any:
+				PreparedStatement pstmt = _preparedStatements[pool][PRECOMMIT_CLEANUP];
+				if (pstmt == null)
+				{
+					pstmt = _theConnection[pool]
+							.prepareStatement("DELETE FROM "
+									+ tableName
+									+ " WHERE UidString = ? AND TypeName = ? AND StateType = "
+									+ StateStatus.OS_COMMITTED);
+					_preparedStatements[pool][PRECOMMIT_CLEANUP] = pstmt;
+				}
+				pstmt.setString(1, objUid.stringForm());
+				pstmt.setString(2, typeName);
+				pstmt.executeUpdate();
+				// done cleanup
+
+				// now do the commit itself:
+				pstmt = _preparedStatements[pool][COMMIT_STATE];
+				if (pstmt == null)
+				{
+					pstmt = _theConnection[pool]
+							.prepareStatement("UPDATE "
+									+ tableName
+									+ " SET StateType = ? WHERE UidString = ? AND TypeName = ? AND StateType = ?");
+					_preparedStatements[pool][COMMIT_STATE] = pstmt;
+				}
+
+				if (currState == StateStatus.OS_UNCOMMITTED)
+				{
+					pstmt.setInt(1, StateStatus.OS_COMMITTED);
+				}
+				else if (currState == StateStatus.OS_UNCOMMITTED_HIDDEN)
+				{
+					pstmt.setInt(1, StateStatus.OS_COMMITTED_HIDDEN);
+				}
+				else
+				{
+					throw new ObjectStoreException("can't commit object "
+							+ objUid + " in state " + currState);
+				}
+
+				pstmt.setString(2, objUid.stringForm());
+				pstmt.setString(3, typeName);
+				pstmt.setInt(4, currState);
+
+				int rowcount = pstmt.executeUpdate();
+
+				if (rowcount > 0)
+				{
+					result = true;
+				}
+			}
+			catch (Throwable e)
+			{
+			    e.printStackTrace();
+			    
+			    if (true)
+			        return false;
+			    
+				cleanup = false;
+				if (retryConnection(e, pool))
+				{
+					return commit_state(objUid, typeName, tableName);
+				}
+				else
+				{
+					throw new ObjectStoreException(e.toString(), e);
+				}
+			}
+			finally
+			{
+				if (cleanup)
+					freePool(pool);
+			}
+		}
+		else
+			throw new ObjectStoreException("commit_state - object with uid "
+					+ objUid + " has no TypeName");
+
+		return result;
+	}
+
+	public boolean hide_state(Uid objUid, String typeName, String tableName)
+			throws ObjectStoreException
+	{
+		boolean hiddenOk = true;
+		boolean cleanup = true;
+
+		/* Bail out if the object store is not set up */
+
+		if (storeValid())
+		{
+			int state = currentState(objUid, typeName, tableName);
+			int pool = getPool();
+			PreparedStatement pstmt = null;
+
+			try
+			{
+				pstmt = _preparedStatements[pool][HIDE_STATE];
+
+				if (pstmt == null)
+				{
+					pstmt = _theConnection[pool]
+							.prepareStatement("UPDATE "
+									+ tableName
+									+ " SET StateType = ? WHERE UidString = ? AND TypeName = ? AND StateType = ?");
+
+					_preparedStatements[pool][HIDE_STATE] = pstmt;
+				}
+			}
+			catch (Exception e) {
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_1(e);
+
+                freePool(pool);
+                return false;
+            }
+
+			try
+			{
+				switch (state)
+				{
+				case StateStatus.OS_UNCOMMITTED_HIDDEN:
+				case StateStatus.OS_COMMITTED_HIDDEN:
+					break;
+				case StateStatus.OS_UNCOMMITTED:
+				{
+					pstmt.setInt(1, StateStatus.OS_UNCOMMITTED_HIDDEN);
+					pstmt.setString(2, objUid.stringForm());
+					pstmt.setString(3, typeName);
+					pstmt.setInt(4, state);
+					pstmt.executeUpdate();
+				}
+					break;
+				case StateStatus.OS_COMMITTED:
+				{
+					pstmt.setInt(1, StateStatus.OS_COMMITTED_HIDDEN);
+					pstmt.setString(2, objUid.stringForm());
+					pstmt.setString(3, typeName);
+					pstmt.setInt(4, state);
+					pstmt.executeUpdate();
+				}
+					break;
+				default:
+					hiddenOk = false;
+				}
+			}
+			catch (Throwable e)
+			{
+				cleanup = false;
+				if (retryConnection(e, pool))
+				{
+					hide_state(objUid, typeName, tableName);
+				}
+				else
+				{
+					throw new ObjectStoreException(e.toString(), e);
+				}
+			}
+			finally
+			{
+				if (cleanup)
+					freePool(pool);
+			}
+		}
+		else
+		{
+			hiddenOk = false;
+		}
+
+		return hiddenOk;
+	}
+
+	public boolean reveal_state(Uid objUid, String typeName, String tableName)
+			throws ObjectStoreException
+	{
+		boolean revealedOk = true;
+		boolean cleanup = true;
+
+		if (storeValid())
+		{
+			int state = currentState(objUid, typeName, tableName);
+
+			int pool = getPool();
+
+			PreparedStatement pstmt = null;
+			try
+			{
+				pstmt = _preparedStatements[pool][REVEAL_STATE];
+
+				if (pstmt == null)
+				{
+					pstmt = _theConnection[pool]
+							.prepareStatement("UPDATE "
+									+ tableName
+									+ " SET StateType = ? WHERE UidString = ? AND AND TypeName = ? StateType = ?");
+					_preparedStatements[pool][REVEAL_STATE] = pstmt;
+				}
+			}
+			catch (Exception e) {
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_2(e);
+
+                freePool(pool);
+                return false;
+            }
+
+			try
+			{
+				switch (state)
+				{
+				case StateStatus.OS_UNCOMMITTED_HIDDEN:
+				{
+					pstmt.setInt(1, StateStatus.OS_UNCOMMITTED);
+					pstmt.setString(2, objUid.stringForm());
+					pstmt.setString(3, typeName);
+					pstmt.setInt(4, state);
+					pstmt.executeUpdate();
+				}
+					break;
+				case StateStatus.OS_COMMITTED_HIDDEN:
+				{
+					pstmt.setInt(1, StateStatus.OS_COMMITTED);
+					pstmt.setString(2, objUid.stringForm());
+					pstmt.setString(3, typeName);
+					pstmt.setInt(4, state);
+					pstmt.executeUpdate();
+				}
+					break;
+				case StateStatus.OS_COMMITTED:
+				case StateStatus.OS_UNCOMMITTED:
+					break;
+				default:
+					revealedOk = false;
+				}
+			}
+			catch (Throwable e)
+			{
+				cleanup = false;
+				if (retryConnection(e, pool))
+				{
+					reveal_state(objUid, typeName, tableName);
+				}
+				else
+				{
+					throw new ObjectStoreException(e.toString(), e);
+				}
+			}
+			finally
+			{
+				if (cleanup)
+					freePool(pool);
+			}
+		}
+		else
+		{
+			revealedOk = false;
+		}
+
+		return revealedOk;
+	}
+
+	/**
+	 * currentState - determine the current state of an object. State search is
+	 * ordered OS_UNCOMMITTED, OS_UNCOMMITTED_HIDDEN, OS_COMMITTED,
+	 * OS_COMMITTED_HIDDEN
+	 */
+	public int currentState(Uid objUid, String typeName, String tableName)
+			throws ObjectStoreException
+	{
+		int theState = StateStatus.OS_UNKNOWN;
+		ResultSet rs = null;
+		boolean cleanup = true;
+
+		if (storeValid())
+		{
+			int pool = getPool();
+			try
+			{
+				PreparedStatement pstmt = _preparedStatements[pool][CURRENT_STATE];
+
+				if (pstmt == null)
+				{
+					pstmt = _theConnection[pool]
+							.prepareStatement("SELECT StateType, UidString FROM "
+									+ tableName
+									+ " WHERE UidString = ? AND TypeName = ?");
+					_preparedStatements[pool][CURRENT_STATE] = pstmt;
+				}
+				
+				pstmt.setString(1, objUid.stringForm());
+				pstmt.setString(2, typeName);
+
+				rs = pstmt.executeQuery();
+
+				// we may have multiple states. need to sort out the order of
+				// precedence
+				// without making multiple round trips out to the db. this gets
+				// a bit messy:
+
+				boolean have_OS_UNCOMMITTED = false;
+				boolean have_OS_UNCOMMITTED_HIDDEN = false;
+				boolean have_OS_COMMITTED = false;
+				boolean have_OS_COMMITTED_HIDDEN = false;
+
+				while (rs.next())
+				{
+					int stateStatus = rs.getInt(1);
+
+					switch (stateStatus)
+					{
+					case StateStatus.OS_UNCOMMITTED:
+						have_OS_UNCOMMITTED = true;
+						break;
+					case StateStatus.OS_COMMITTED:
+						have_OS_COMMITTED = true;
+						break;
+					case StateStatus.OS_COMMITTED_HIDDEN:
+						have_OS_COMMITTED_HIDDEN = true;
+						break;
+					case StateStatus.OS_UNCOMMITTED_HIDDEN:
+						have_OS_UNCOMMITTED_HIDDEN = true;
+						break;
+					}
+				}
+
+				// examine in reverse order:
+				if (have_OS_COMMITTED_HIDDEN)
+				{
+					theState = StateStatus.OS_COMMITTED_HIDDEN;
+				}
+				if (have_OS_COMMITTED)
+				{
+					theState = StateStatus.OS_COMMITTED;
+				}
+				if (have_OS_UNCOMMITTED_HIDDEN)
+				{
+					theState = StateStatus.OS_UNCOMMITTED_HIDDEN;
+				}
+				if (have_OS_UNCOMMITTED)
+				{
+					theState = StateStatus.OS_UNCOMMITTED;
+				}
+			}
+			catch (Throwable e)
+			{
+				cleanup = false;
+				try
+				{
+					if (rs != null)
+						rs.close();
+				}
+				catch (SQLException re)
+				{
+					// Just in case it's already closed
+				}
+				if (retryConnection(e, pool))
+				{
+					return currentState(objUid, typeName, tableName);
+				}
+				else
+				{
+                    tsLogger.i18NLogger.warn_objectstore_JDBCImple_3(e);
+
+					return StateStatus.OS_UNKNOWN;
+				}
+			}
+			finally
+			{
+				if (cleanup)
+				{
+					try
+					{
+						if (rs != null)
+							rs.close();
+					}
+					catch (SQLException e)
+					{
+						// Just in case it's already closed
+					}
+					freePool(pool);
+				}
+			}
+		}
+
+		return theState;
+	}
+
+	/**
+	 * allObjUids - Given a type name, return an ObjectState that contains all
+	 * of the uids of objects of that type.
+	 */
+	public boolean allObjUids(String typeName, InputObjectState state,
+			int match, String tableName) throws ObjectStoreException
+	{
+		int pool = getPool();
+
+		try
+		{
+			OutputObjectState store = new OutputObjectState();
+			Statement stmt = _theConnection[pool].createStatement();
+			ResultSet rs = null;
+
+			try
+			{
+				/*
+				 * Not used enough to warrant a PreparedStatement.
+				 */
+				rs = stmt.executeQuery("SELECT DISTINCT UidString FROM "
+						+ tableName + " WHERE TypeName = '" + typeName + "'");
+
+				boolean finished = false;
+
+				while (!finished && rs.next())
+				{
+					Uid theUid = null;
+
+					try
+					{
+						theUid = new Uid(rs.getString(1));
+						UidHelper.packInto(theUid, store);
+					}
+					catch (IOException ex) {
+                        tsLogger.i18NLogger.warn_objectstore_JDBCImple_5(ex);
+
+                        return false;
+                    }
+					catch (Exception e) {
+                        tsLogger.i18NLogger.warn_objectstore_JDBCImple_4(e);
+
+                        finished = true;
+                    }
+				}
+			}
+			catch (Exception e) {
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_4(e);
+            }
+			finally
+			{
+				try
+				{
+					if (rs != null)
+						rs.close();
+				}
+				catch (SQLException e)
+				{
+					// Just in case it's already closed
+				}
+				try
+				{
+					if (stmt != null)
+						stmt.close();
+				}
+				catch (SQLException e)
+				{
+					// Just in case it's already closed
+				}
+			}
+
+			try
+			{
+			    UidHelper.packInto(Uid.nullUid(), store);
+			}
+			catch (IOException e)
+			{
+				throw new ObjectStoreException("allObjUids - could not pack end of list Uid.", e);
+			}
+
+			state.setBuffer(store.buffer());
+
+			store = null;
+
+			return true;
+		}
+		catch (Exception e) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_4(e);
+        }
+		finally
+		{
+			freePool(pool);
+		}
+
+		return false;
+	}
+
+	public boolean allTypes(InputObjectState foundTypes, String tableName)
+			throws ObjectStoreException
+	{
+		int pool = getPool();
+
+		try
+		{
+			OutputObjectState store = new OutputObjectState();
+			Statement stmt = _theConnection[pool].createStatement();
+			ResultSet rs = null;
+
+			try
+			{
+				/*
+				 * Not used enough to warrant a PreparedStatement.
+				 */
+				rs = stmt.executeQuery("SELECT DISTINCT TypeName FROM "
+						+ tableName);
+
+				boolean finished = false;
+
+				while (!finished && rs.next())
+				{
+					try
+					{
+						String type = rs.getString(1);
+						store.packString(type);
+					}
+					catch (IOException ex) {
+                        tsLogger.i18NLogger.warn_objectstore_JDBCImple_7(ex);
+
+                        return false;
+                    }
+					catch (Exception e) {
+                        tsLogger.i18NLogger.warn_objectstore_JDBCImple_6(e);
+
+                        finished = true;
+                    }
+				}
+			}
+			catch (Exception e) {
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_6(e);
+            }
+			finally
+			{
+				try
+				{
+					if (rs != null)
+						rs.close();
+				}
+				catch (SQLException e)
+				{
+					// Just in case it's already closed
+				}
+				try
+				{
+					if (stmt != null)
+						stmt.close();
+				}
+				catch (SQLException e)
+				{
+					// Just in case it's already closed
+				}
+			}
+
+			try
+			{
+				store.packString("");
+			}
+			catch (IOException e)
+			{
+				throw new ObjectStoreException(tsLogger.i18NLogger.get_objectstore_packProblem(), e);
+			}
+
+			foundTypes.setBuffer(store.buffer());
+
+			return true;
+		}
+		catch (Exception e) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_6(e);
+        }
+		finally
+		{
+			freePool(pool);
+		}
+
+		return false;
+	}
+
+	public boolean remove_state(Uid objUid, String name, int ft,
+			String tableName) throws ObjectStoreException
+	{
+		boolean removeOk = false;
+		boolean cleanup = true;
+
+		if (!storeValid())
+			return false;
+
+		if (name != null)
+		{
+			if ((ft == StateStatus.OS_COMMITTED)
+					|| (ft == StateStatus.OS_UNCOMMITTED))
+			{
+				int pool = getPool();
+
+				try
+				{
+					PreparedStatement pstmt = _preparedStatements[pool][REMOVE_STATE];
+
+					if (pstmt == null)
+					{
+						pstmt = _theConnection[pool]
+								.prepareStatement("DELETE FROM "
+										+ tableName
+										+ " WHERE UidString = ? AND TypeName = ? AND StateType = ?");
+
+						_preparedStatements[pool][REMOVE_STATE] = pstmt;
+					}
+
+					pstmt.setString(1, objUid.stringForm());
+					pstmt.setString(2, name);
+					pstmt.setInt(3, ft);
+					if (pstmt.executeUpdate() > 0)
+					{
+						removeOk = true;
+					}
+				}
+				catch (Throwable e)
+				{
+					cleanup = false;
+					if (retryConnection(e, pool))
+					{
+						return remove_state(objUid, name, ft, tableName);
+					}
+					else {
+                        tsLogger.i18NLogger.warn_objectstore_JDBCImple_8(e);
+
+                        removeOk = false;
+                    }
+				}
+				finally
+				{
+					if (cleanup)
+						freePool(pool);
+				}
+			}
+			else {
+                removeOk = false;
+                // can only remove (UN)COMMITTED objs
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_9(Integer.toString(ft), objUid);
+            }
+		}
+		else {
+            removeOk = false;
+
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_10(objUid);
+        }
+
+		return removeOk;
+	}
+
+	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 == StateStatus.OS_COMMITTED) || (ft == StateStatus.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 {
+                        tsLogger.i18NLogger.warn_objectstore_JDBCImple_readfailed();
+                    }
+				}
+				catch (Throwable e)
+				{
+				    e.printStackTrace();
+				    
+					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;
+	}
+
+    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 {
+                    tsLogger.i18NLogger.warn_objectstore_JDBCImple_writefailed(e);
+                }
+			}
+			finally
+			{
+				try
+				{
+					rs.close();
+				}
+				// Ignore
+				catch (Exception re) {}
+				freePool(pool);
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Set up the store for use.
+	 */
+	public boolean initialise(Connection conn, JDBCAccess jdbcAccess,
+			String tableName, JDBCStoreEnvironmentBean jdbcStoreEnvironmentBean) throws SQLException
+	{
+        shareStatus = jdbcStoreEnvironmentBean.getShare();
+
+        _poolSizeInit = jdbcStoreEnvironmentBean.getJdbcPoolSizeInitial();
+        if (_poolSizeInit < 1) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_11(Integer.toString(_poolSizeInit));
+            _poolSizeInit = 1;
+        }
+
+        _poolSizeMax = jdbcStoreEnvironmentBean.getJdbcPoolSizeMaximum();
+        if (_poolSizeMax < _poolSizeInit) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_12(Integer.toString(_poolSizeMax));
+            _poolSizeMax = _poolSizeInit;
+        }
+
+		_poolPutConn = jdbcStoreEnvironmentBean.isJdbcPoolPutConnections();
+        
+		_jdbcAccess = jdbcAccess;
+		_theConnection = new Connection[_poolSizeMax];
+		_theConnection[0] = conn;
+        conn.setAutoCommit(true);
+
+		try
+		{
+			for (int i = 1; i < _poolSizeInit; i++)
+			{
+				_theConnection[i] = _jdbcAccess.getConnection();
+				_theConnection[i].setAutoCommit(true);
+			}
+		}
+		catch (Exception e) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_13(e);
+
+            _isValid = false;
+            return _isValid;
+        }
+
+		for (int i = _poolSizeInit; i < _poolSizeMax; i++)
+		{
+			_theConnection[i] = null;
+		}
+		if (_inUse == null)
+		{
+			_inUse = new boolean[_poolSizeMax];
+		}
+
+		_preparedStatements = new PreparedStatement[_poolSizeMax][];
+
+		for (int i = 0; i < _poolSizeMax; i++)
+		{
+			_preparedStatements[i] = new PreparedStatement[STATEMENT_SIZE];
+
+			for (int j = 0; j < STATEMENT_SIZE; j++)
+			{
+				_preparedStatements[i][j] = null;
+			}
+		}
+
+		try
+		{
+			Statement stmt = _theConnection[0].createStatement();
+
+			// table [type, object UID, format, blob]
+
+			// Need some management interface to delete the table!
+
+			if (jdbcAccess.dropTable())
+			{
+				try
+				{
+					stmt.executeUpdate("DROP TABLE " + tableName);
+				}
+				catch (SQLException ex)
+				{
+					// don't want to print error - chances are it
+					// just reports that the table does not exist
+					// ex.printStackTrace();
+				}
+			}
+
+			try
+			{
+				createTable(stmt, tableName);
+			}
+			catch (SQLException ex)
+			{
+				// assume this is reporting that the table already exists:
+			}
+
+			_isValid = true;
+		}
+		catch (Exception e) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_13(e);
+
+            _isValid = false;
+        }
+
+		return _isValid;
+	}
+
+	/**
+	 * Add a new table to an existing implementation.
+	 *
+	 */
+	protected void addTable(String tableName) throws Exception
+	{
+		int pool = getPool();
+		Statement stmt = _theConnection[pool].createStatement();
+
+		try
+		{
+			createTable(stmt, tableName);
+		}
+		catch (SQLException ex)
+		{
+			// assume this is reporting that the table already exists:
+		}
+		finally
+		{
+			freePool(pool);
+		}
+
+	}
+
+	/**
+	 * Use implementation-specific code to create the store table. Called from
+	 * initialise() and addTable(), above.
+	 */
+	protected abstract void createTable(Statement stmt, String tableName)
+			throws SQLException;
+
+	public abstract String name();
+
+    protected abstract int getMaxStateSize();
+
+	// protected abstract boolean exists (String state);
+
+	protected final int getState(String state)
+	{
+		try
+		{
+			Integer st = (Integer) stateCache.get(state);
+
+			if (st != null)
+			{
+				return st.intValue();
+			}
+		}
+		catch (Exception ex) {
+            tsLogger.i18NLogger.warn_objectstore_JDBCImple_14(ex);
+        }
+
+		return StateStatus.OS_UNKNOWN;
+	}
+
+	protected final void addToCache(Uid state, int status)
+	{
+		if (shareStatus == StateType.OS_UNSHARED)
+		{
+			stateCache.put(state, new Integer(status));
+		}
+	}
+
+	protected final void removeFromCache(String state)
+	{
+		removeFromCache(state, true);
+	}
+
+	/**
+	 * Print a warning if the file to be removed is not in the cache.
+	 */
+	protected final void removeFromCache(String state, boolean warn)
+	{
+		if (shareStatus == StateType.OS_UNSHARED)
+		{
+			if ((stateCache.remove(state) == null) && warn) {
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_15(state);
+            }
+		}
+	}
+
+	final void setShareStatus(int status)
+	{
+		shareStatus = status;
+	}
+
+	/**
+	 * retryConnection. Called in exeption handlers where the problem may be due
+	 * to use of a stale (broken) cached connection. If this is the case, we
+	 * re-establish the connection before returning.
+	 *
+	 * @param e
+	 *            The exception, which may be due to a bad connection.
+	 * @param pool
+	 *            The pooled connection which was in use when the exception was
+	 *            thrown and which is therfore suspect.
+	 * @return true if the connection was reestablished (in which case it is
+	 *         worth retrying the calling function), false is a broken
+	 *         connection was unlikely to be the problem.
+	 */
+	protected boolean retryConnection(Throwable e, int pool)
+	{
+		if (e instanceof SQLException)
+		{
+			// To do: Look for specific driver error codes here...
+			try
+			{
+				reconnect(pool);
+			}
+			catch (Exception e1)
+			{
+				return false;
+			}
+			synchronized (_inUse)
+			{
+				_inUse[pool] = true;
+			}
+			freePool(pool);
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * reconnect(int pool): re-establish a potentially failed cached connection.
+	 */
+	protected void reconnect(int pool) throws SQLException
+	{
+		Connection newConnection = _theConnection[pool];
+		_theConnection[pool] = null;
+
+		// just in case the connection is still live,
+		// attempt to clean it up nicely:
+		try
+		{
+			newConnection.close();
+		}
+		catch (SQLException e)
+		{
+		}
+		_jdbcAccess.putConnection(newConnection);
+
+		// release the statements associated with the closed
+		// connection so they dont get used by mistake...
+		for (int i = 0; i < STATEMENT_SIZE; i++)
+		{
+			_preparedStatements[pool][i] = null;
+		}
+
+		// re-establish the connection:
+		newConnection = _jdbcAccess.getConnection();
+		try
+		{
+			newConnection.setAutoCommit(true);
+		}
+		catch (SQLException e)
+		{
+			newConnection = null;
+			throw e;
+		}
+		_theConnection[pool] = newConnection;
+	}
+
+	/**
+	 * Allocate a database connection from the pool: Walks the array and
+	 * allocates the first available connection. If non are free, waits before
+	 * trying again.
+	 */
+	protected int getPool()
+	{
+		int i = 0;
+		int rtn = -1;
+
+		synchronized (_inUse)
+		{
+			while (true)
+			{
+				if (!_inUse[i])
+				{
+					if (_theConnection[i] == null) /*
+													 * i >= _poolSizeInit && i <
+													 * _poolSizeMax
+													 */
+					{
+						try
+						{
+							_theConnection[i] = _jdbcAccess.getConnection();
+							_inUse[i] = true;
+							rtn = i;
+							break;
+						}
+						catch (Exception e) {
+                            tsLogger.i18NLogger.warn_objectstore_JDBCImple_16(e);
+                        }
+					}
+					else
+					{
+						_inUse[i] = true;
+						rtn = i;
+						break;
+					}
+				}
+
+				i++;
+				if (i == _poolSizeMax)
+				{
+					i = 0;
+					try
+					{
+						_inUse.wait();
+					}
+					catch (InterruptedException ie)
+					{
+						tsLogger.i18NLogger.info_objectstore_JDBCImple_17();
+					}
+				}
+			}
+		}
+
+		return rtn;
+	}
+
+	/**
+	 * return a connection to the free pool, optionally closing it.
+	 */
+	protected void freePool(int pool)
+	{
+		/*
+		 * try { _theConnection[pool].commit(); } catch(Exception e) {}
+		 */
+
+		synchronized (_inUse)
+		{
+			if (_inUse[pool] == false) {
+                tsLogger.i18NLogger.warn_objectstore_JDBCImple_18();
+            }
+			_inUse[pool] = false;
+			_inUse.notifyAll();
+		}
+	}
+
+	private int shareStatus;
+
+	private Hashtable stateCache = new Hashtable();
+
+	protected JDBCAccess _jdbcAccess = null;
+
+	protected Connection[] _theConnection = null;
+
+	protected boolean _isValid = false;
+
+	protected PreparedStatement[][] _preparedStatements = null;
+
+	/*
+	 * IMPORTANT: remember to update if we add more prepared statements!
+	 */
+	protected static final int COMMIT_STATE = 0;
+
+	protected static final int HIDE_STATE = 1;
+
+	protected static final int REVEAL_STATE = 2;
+
+	protected static final int CURRENT_STATE = 3;
+
+	protected static final int READ_STATE = 4;
+
+	protected static final int REMOVE_STATE = 5;
+
+	protected static final int WRITE_STATE_NEW = 6;
+
+	protected static final int WRITE_STATE_EXISTING = 7;
+
+	protected static final int SELECT_FOR_WRITE_STATE = 8;
+
+	protected static final int READ_WRITE_SHORTCUT = 9;
+
+	protected static final int PRECOMMIT_CLEANUP = 10;
+
+	// size:
+	protected static final int STATEMENT_SIZE = 11;
+
+	// record the status of each connection in the pool:
+	protected boolean[] _inUse = null;
+
+	protected int _poolSizeInit = 1; /* Initial pool size */
+
+	protected int _poolSizeMax = 1; /* Maximum pool size */
+
+	protected boolean _poolPutConn = false; /*
+											 * Return (putConnection()) after
+											 * use?
+											 */
+}

Copied: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStore.java (from rev 35087, 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/JDBCStore.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStore.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -0,0 +1,690 @@
+/*
+ * 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: JDBCStore.java 2342 2006-03-30 13:06:17Z  $
+ */
+
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.arjuna.objectstore.ObjectStoreAPI;
+import com.arjuna.ats.arjuna.state.*;
+
+import com.arjuna.ats.arjuna.logging.tsLogger;
+
+import com.arjuna.ats.arjuna.objectstore.StateStatus;
+import com.arjuna.ats.arjuna.objectstore.StateType;
+import com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess;
+import com.arjuna.ats.arjuna.common.*;
+
+import java.sql.*;
+import java.util.HashMap;
+
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.exceptions.FatalError;
+
+import java.io.IOException;
+
+/**
+ * An object store implementation which uses a JDBC database for maintaining
+ * object states. All states are maintained within a single table.
+ *
+ * It is assumed that only one object will use a given instance of the
+ * JDBCStore. Hence, there is no need for synchronizations.
+ */
+
+public class JDBCStore implements ObjectStoreAPI
+{
+    @Override
+    public void start() {}
+
+    @Override
+    public void stop() {}
+    
+    public boolean allObjUids (String s, InputObjectState buff) throws ObjectStoreException
+    {
+        return allObjUids(s, buff, StateStatus.OS_UNKNOWN);
+    }
+
+    /**
+     * Does this store need to do the full write_uncommitted/commit protocol?
+     *
+     * @return <code>true</code> if full commit is needed, <code>false</code>
+     * otherwise.
+     */
+
+    public boolean fullCommitNeeded ()
+    {
+        return true;
+    }
+
+    /**
+     * Some object store implementations may be running with automatic
+     * sync disabled. Calling this method will ensure that any states are
+     * flushed to disk.
+     */
+
+    public void sync () throws java.io.SyncFailedException, ObjectStoreException
+    {
+    }
+
+    /**
+     * Is the current state of the object the same as that provided as the last
+     * parameter?
+     *
+     * @param u The object to work on.
+     * @param tn The type of the object.
+     * @param st The expected type of the object.
+     *
+     * @return <code>true</code> if the current state is as expected,
+     * <code>false</code> otherwise.
+     */
+
+    public boolean isType (Uid u, String tn, int st) throws ObjectStoreException
+    {
+        return ((currentState(u, tn) == st) ? true : false);
+    }
+
+    public String getStoreName()
+    {
+        if (storeValid())
+            return getAccessClassName() + ":" + getTableName();
+        else
+            return "Invalid";
+    }
+
+    public boolean commit_state(Uid objUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.commit_state(" + objUid + ", " + tName + ")");
+        }
+
+        /* Bail out if the object store is not set up */
+
+        if (!storeValid())
+            return false;
+        else
+            return _theImple.commit_state(objUid, tName, getTableName());
+    }
+
+    public boolean hide_state(Uid objUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("ShadowingStore.hide_state(" + objUid + ", " + tName + ")");
+        }
+
+        /* Bail out if the object store is not set up */
+
+        if (storeValid())
+            return _theImple.hide_state(objUid, tName, getTableName());
+        else
+            return false;
+    }
+
+    public boolean reveal_state(Uid objUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("ShadowingStore.reveal_state(" + objUid + ", " + tName
+                    + ")");
+        }
+
+        if (storeValid())
+            return _theImple.reveal_state(objUid, tName, getTableName());
+        else
+            return false;
+    }
+
+    /*
+    * Determine current state of object. State search is ordered
+    * OS_UNCOMMITTED, OS_UNCOMMITTED_HIDDEN, OS_COMMITTED, OS_COMMITTED_HIDDEN
+    */
+
+    public int currentState(Uid objUid, String tName)
+            throws ObjectStoreException
+    {
+        if (storeValid())
+            return _theImple.currentState(objUid, tName, getTableName());
+        else
+            return StateStatus.OS_UNKNOWN;
+    }
+
+    /**
+     * Read an uncommitted instance of State out of the object store. The
+     * instance is identified by the unique id and type
+     */
+
+    public InputObjectState read_committed(Uid storeUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.read_committed(" + storeUid + ", "
+                    + tName + ")");
+        }
+
+        return read_state(storeUid, tName, StateStatus.OS_COMMITTED);
+    }
+
+    public InputObjectState read_uncommitted(Uid storeUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.read_uncommitted(" + storeUid + ", " + tName
+                    + ")");
+        }
+
+        return read_state(storeUid, tName, StateStatus.OS_UNCOMMITTED);
+    }
+
+    public boolean remove_committed(Uid storeUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.remove_committed(" + storeUid + ", " + tName
+                    + ")");
+        }
+
+        return remove_state(storeUid, tName, StateStatus.OS_COMMITTED);
+    }
+
+    public boolean remove_uncommitted(Uid storeUid, String tName)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.remove_uncommitted(" + storeUid + ", " + tName
+                    + ")");
+        }
+
+        return remove_state(storeUid, tName, StateStatus.OS_UNCOMMITTED);
+    }
+
+    public boolean write_committed(Uid storeUid, String tName,
+                                   OutputObjectState state) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.write_committed(" + storeUid + ", " + tName
+                    + ")");
+        }
+
+        return write_state(storeUid, tName, state, StateStatus.OS_COMMITTED);
+    }
+
+    public boolean write_uncommitted(Uid storeUid, String tName,
+                                     OutputObjectState state) throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.write_uncommitted(" + storeUid + ", " + tName
+                    + ", " + state + ")");
+        }
+
+        return write_state(storeUid, tName, state, StateStatus.OS_UNCOMMITTED);
+    }
+
+    public final boolean storeValid()
+    {
+        return _isValid;
+    }
+
+    /*
+    * Given a type name return an ObjectState that contains all of the uids of
+    * objects of that type
+    */
+
+    public boolean allObjUids(String tName, InputObjectState state, int match)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.allObjUids(" + tName + ", " + state + ", "
+                    + match + ")");
+        }
+
+        if (storeValid())
+            return _theImple.allObjUids(tName, state, match, getTableName());
+        else
+            return false;
+    }
+
+    public boolean allTypes(InputObjectState foundTypes)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.allTypes(" + foundTypes + ")");
+        }
+
+        if (storeValid())
+            return _theImple.allTypes(foundTypes, getTableName());
+        else
+            return false;
+    }
+
+    public synchronized void packInto(OutputBuffer buff) throws IOException
+    {
+        buff.packString(getAccessClassName());
+        buff.packString(getTableName());
+    }
+
+    public synchronized void unpackFrom(InputBuffer buff) throws IOException
+    {
+        setAccessClassName(buff.unpackString());
+        setTableName(buff.unpackString());
+    }
+
+    protected InputObjectState read_state(Uid objUid, String tName, int ft)
+            throws ObjectStoreException
+    {
+        if (!storeValid())
+            return null;
+        else
+            return _theImple.read_state(objUid, tName, ft, getTableName());
+    }
+
+    /**
+     * We don't actually delete the state entry, only change its type.
+     */
+
+    protected boolean remove_state(Uid objUid, String name, int ft)
+            throws ObjectStoreException
+    {
+        if (tsLogger.logger.isTraceEnabled()) {
+            tsLogger.logger.trace("JDBCStore.remove_state("
+                    + objUid + ", " + name + ", "
+                    + StateType.stateTypeString(ft) + ")");
+        }
+
+        if (!storeValid())
+            return false;
+        else
+            return _theImple.remove_state(objUid, name, ft, getTableName());
+    }
+
+    protected boolean write_state(Uid objUid, String tName,
+                                  OutputObjectState state, int s) throws ObjectStoreException
+    {
+        if (!storeValid())
+            return false;
+        else
+            return _theImple.write_state(objUid, tName, state, s,
+                    getTableName());
+    }
+
+    protected JDBCStore(JDBCStoreEnvironmentBean jdbcStoreEnvironmentBean) throws ObjectStoreException
+    {
+        this.jdbcStoreEnvironmentBean = jdbcStoreEnvironmentBean;
+
+         _jdbcAccessClassName = jdbcStoreEnvironmentBean.getJdbcUserDbAccess();
+
+        if(_jdbcAccessClassName == null) {
+            throw new ObjectStoreException(tsLogger.i18NLogger.get_objectstore_JDBCStore_5());
+        }
+
+        setTableName(_defaultTableName);
+
+        try
+        {
+            setupStore(_jdbcAccessClassName, getTableName());
+        }
+        catch (Exception e)
+        {
+            tsLogger.i18NLogger.fatal_objectstore_JDBCStore_1(getJDBCAccess().toString(), getTableName());
+            throw new ObjectStoreException(e);
+        }
+
+        _isValid = true;
+    }
+
+    /**
+     * Get the JDBC access class name.
+     *
+     * @return The access class name.
+     */
+    protected String getAccessClassName()
+    {
+        return _jdbcAccessClassName;
+    }
+
+    /**
+     * Set the JDBC access class name.
+     *
+     * @param jdbcAccessClassName access class name.
+     */
+    protected void setAccessClassName(String jdbcAccessClassName)
+    {
+        _jdbcAccessClassName = jdbcAccessClassName;
+    }
+
+    /**
+     * Get the JDBC default table name.
+     *
+     * @return The default table name.
+     */
+    protected String getDefaultTableName()
+    {
+        return _defaultTableName;
+    }
+
+    /**
+     * Get the JDBC access class.
+     *
+     * @return The jdbc access variable.
+     */
+    protected JDBCAccess getJDBCAccess()
+    {
+        return _jdbcAccess;
+    }
+
+    /**
+     * Set the JDBC access class.
+     *
+     * @param jdbcAccess
+     *            The jdbc access variable.
+     */
+    protected void setJDBCAccess(JDBCAccess jdbcAccess)
+    {
+        _jdbcAccess = jdbcAccess;
+    }
+
+    /**
+     * Get the JDBC table name.
+     *
+     * @return The table name.
+     */
+    protected String getTableName()
+    {
+        return _jdbcTableName;
+    }
+
+    /**
+     * Set the JDBC table name.
+     *
+     * @param tableName
+     *            The table name.
+     */
+    protected void setTableName(String tableName)
+    {
+        _jdbcTableName = tableName;
+    }
+
+    protected void initialise(String tableName) throws Exception
+    {
+        String jdbcAccessClassName = getAccessClassName();
+
+        if (jdbcAccessClassName == null)
+        {
+            throw new FatalError(tsLogger.i18NLogger.get_objectstore_JDBCStore_5());
+        }
+
+        try
+        {
+            setupStore(jdbcAccessClassName, tableName);
+        }
+        catch (Exception e)
+        {
+            tsLogger.i18NLogger.fatal_objectstore_JDBCStore_1(getJDBCAccess().toString(), getTableName());
+            throw e;
+        }
+
+        _isValid = true;
+    }
+
+    /*
+    * Try to create the original and shadow/hidden tables. If this fails, then
+    * we will exit.
+    */
+    @SuppressWarnings("unchecked")
+    protected void setupStore(String jdbcAccessClassName, String tableName)
+            throws Exception
+    {
+        if (jdbcAccessClassName == null || jdbcAccessClassName.length() == 0)
+            throw new ObjectStoreException();
+
+        final JDBCAccess jdbcAccess;
+        synchronized (_theAccesses)
+        {
+            final Object jdbcAccessObject = _theAccesses
+                    .get(jdbcAccessClassName);
+            if (jdbcAccessObject != null)
+            {
+                jdbcAccess = (JDBCAccess) jdbcAccessObject;
+            }
+            else
+            {
+                try
+                {
+                    final Class jdbcAccessClass = Thread.currentThread()
+                            .getContextClassLoader().loadClass(
+                                    jdbcAccessClassName);
+                    jdbcAccess = (JDBCAccess) jdbcAccessClass.newInstance();
+                }
+                catch (final Exception ex)
+                {
+                    tsLogger.i18NLogger.fatal_objectstore_JDBCStore_2(jdbcAccessClassName, ex);
+                    throw ex;
+                }
+                _theAccesses.put(jdbcAccessClassName, jdbcAccess);
+            }
+        }
+        setJDBCAccess(jdbcAccess);
+
+        final String impleTableName;
+        if ((tableName != null) && (tableName.length() > 0))
+        {
+            impleTableName = tableName;
+        }
+        else
+        {
+            final String jdbcAccessTableName = jdbcAccess.tableName();
+            if ((jdbcAccessTableName != null)
+                    && (jdbcAccessTableName.length() > 0))
+            {
+                impleTableName = jdbcAccessTableName;
+            }
+            else
+            {
+                impleTableName = getDefaultTableName();
+            }
+        }
+
+        setTableName(impleTableName);
+
+        final String impleKey = jdbcAccessClassName + ":" + impleTableName;
+
+        synchronized (_theImples)
+        {
+            final Object currentImple = _theImples.get(impleKey);
+            if (currentImple != null)
+            {
+                _theImple = (com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple) currentImple;
+            }
+            else
+            {
+                try
+                {
+                    /*
+                    * This had better not be an Arjuna jdbc connection!
+                    */
+                    final Connection connection;
+
+                    try
+                    {
+                        connection = jdbcAccess.getConnection();
+                    }
+                    catch (final SQLException sqle)
+                    {
+                        tsLogger.i18NLogger.fatal_objectstore_JDBCStore_2("getConnection()", sqle);
+                        throw sqle;
+                    }
+
+                    if (connection == null)
+                    {
+                        tsLogger.i18NLogger.fatal_objectstore_JDBCStore_1(getJDBCAccess().toString(), getTableName());
+                        throw new SQLException("getConnection returned null");
+                    }
+                    boolean success = false;
+                    try
+                    {
+                        connection.setAutoCommit(true);
+                        final com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple jdbcImple;
+                        try
+                        {
+                            final Class jdbcImpleClass = getJDBCClass(connection);
+                            jdbcImple = (com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple) jdbcImpleClass
+                                    .newInstance();
+                        }
+                        catch (final Exception ex)
+                        {
+                            tsLogger.i18NLogger.fatal_objectstore_JDBCStore_2(getJDBCAccess().toString(), ex);
+                            throw ex;
+                        }
+
+                        if (!jdbcImple.initialise(connection, jdbcAccess,
+                                impleTableName, jdbcStoreEnvironmentBean)) {
+                            tsLogger.i18NLogger.warn_objectstore_JDBCStore_3();
+                            throw new ObjectStoreException();
+                        }
+                        else
+                        {
+                            _theImples.put(impleKey, jdbcImple);
+                            _theImple = jdbcImple;
+                            success = true;
+                        }
+                    }
+                    finally
+                    {
+                        if (!success)
+                        {
+                            try
+                            {
+                                connection.close();
+                            }
+                            catch (final SQLException sqle)
+                            {
+                            } // Ignore exception
+                        }
+                    }
+                }
+                catch (Exception e)
+                {
+                    tsLogger.logger.warn(e);
+                    throw e;
+                }
+            }
+            _isValid = true;
+        }
+    }
+
+    /**
+     * Attempt to load the database class. &nbsp;This method searches for a
+     * class called <name>_<major>_<minor>, then <name>_<major> and finally
+     * <dbName>
+     *
+     * @param conn
+     *            A database connection.
+     * @return The database class.
+     * @throws ClassNotFoundException
+     *             If no database class can be found.
+     * @throws SQLException
+     *             If the database connection cannot be interrogated.
+     */
+    @SuppressWarnings("unchecked")
+    protected Class getJDBCClass(Connection conn)
+            throws ClassNotFoundException, SQLException
+    {
+        DatabaseMetaData md = conn.getMetaData();
+
+        String name = md.getDriverName();
+        int major = md.getDriverMajorVersion();
+        int minor = md.getDriverMinorVersion();
+
+        /*
+        * Check for spaces in the name - our implementation classes are always
+        * just the first part of such names.
+        */
+
+        int index = name.indexOf(' ');
+
+        if (index != -1)
+            name = name.substring(0, index);
+
+        name = name.replaceAll("-", "_");
+
+        name = name.toLowerCase();
+
+        final ClassLoader classLoader = Thread.currentThread()
+                .getContextClassLoader();
+        final String packageName = getClass().getPackage().getName() + ".jdbc.";
+        try
+        {
+            return classLoader.loadClass(packageName + name + "_" + major + "_"
+                    + minor + "_driver");
+        }
+        catch (final ClassNotFoundException cnfe)
+        {
+        }
+        try
+        {
+            return classLoader.loadClass(packageName + name + "_" + major
+                    + "_driver");
+        }
+        catch (final ClassNotFoundException cnfe)
+        {
+        }
+        return classLoader.loadClass(packageName + name + "_driver");
+    }
+
+    protected boolean supressEntry(String name)
+    {
+        return true;
+    }
+
+    /*
+    * Instance specific data.
+    */
+
+    protected boolean _isValid;
+
+    protected com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple _theImple;
+
+    private JDBCAccess _jdbcAccess;
+
+    private String _jdbcAccessClassName;
+
+    private String _jdbcTableName;
+
+    private static String _defaultTableName = "JBossTSTable";
+
+    protected final JDBCStoreEnvironmentBean jdbcStoreEnvironmentBean;
+    
+    /*
+    * Class data.
+    */
+
+    protected static final HashMap _theImples = new HashMap();
+
+    protected static final HashMap _theAccesses = new HashMap();
+}

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBean.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBean.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * 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) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+import com.arjuna.ats.arjuna.objectstore.StateType;
+
+/**
+ * A JavaBean containing configuration properties for the JDBC based objectstore implementation.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+public class JDBCStoreEnvironmentBean
+{
+    private volatile String jdbcUserDbAccess = null;
+    private volatile String jdbcTxDbAccess = null;
+    private volatile int jdbcPoolSizeInitial = 1;
+    private volatile int jdbcPoolSizeMaximum = 1;
+    private volatile boolean jdbcPoolPutConnections = false;
+
+    private volatile int share = StateType.OS_UNSHARED;
+
+    /**
+     * Returns the classname of the JDBCAccess implementation used for the ObjectStore.
+     *
+     * Default: null
+     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcUserDbAccess
+     *
+     * @return the name of a class implementing JDBCAccess.
+     */
+    public String getJdbcUserDbAccess()
+    {
+        return jdbcUserDbAccess;
+    }
+
+    /**
+     * Sets the classname of the JDBCAccess implementation used for the ObjectStore.
+     *
+     * @param jdbcUserDbAccess the name of the class implementing JDBCAccess.
+     */
+    public void setJdbcUserDbAccess(String jdbcUserDbAccess)
+    {
+        this.jdbcUserDbAccess = jdbcUserDbAccess;
+    }
+
+    /**
+     * Returns the classname of the JDBCAccess implementation used for the ActionStore.
+     *
+     * Default: null
+     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcTxDbAccess
+     *
+     * @return the name of a class implementing JDBCAccess.
+     */
+    public String getJdbcTxDbAccess()
+    {
+        return jdbcTxDbAccess;
+    }
+
+    /**
+     * Sets the classname of the JDBCAccess implementation used for the ActionStore.
+     *
+     * @param jdbcTxDbAccess the name of the class implementing JDBCAccess.
+     */
+    public void setJdbcTxDbAccess(String jdbcTxDbAccess)
+    {
+        this.jdbcTxDbAccess = jdbcTxDbAccess;
+    }
+
+    /**
+     * Returns the number of connections to initialize in the pool at startup.
+     *
+     * Default: 1
+     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeInitial
+     *
+     * @return the initial size of the connection pool.
+     */
+    public int getJdbcPoolSizeInitial()
+    {
+        return jdbcPoolSizeInitial;
+    }
+
+    /**
+     * Sets the number of the connection to initialize in the pool at startup.
+     *
+     * @param jdbcPoolSizeInitial the initial size of the connection pool.
+     */
+    public void setJdbcPoolSizeInitial(int jdbcPoolSizeInitial)
+    {
+        this.jdbcPoolSizeInitial = jdbcPoolSizeInitial;
+    }
+
+    /**
+     * Returns the maximum number of connections to hold in the pool.
+     *
+     * Default: 1
+     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeMaximum"
+     *
+     * @return the maximum size of the connection pool.
+     */
+    public int getJdbcPoolSizeMaximum()
+    {
+        return jdbcPoolSizeMaximum;
+    }
+
+    /**
+     * Sets the maximum number of connections to hold in the pool.
+     *
+     * @param jdbcPoolSizeMaximum the maximum size of the connection pool.
+     */
+    public void setJdbcPoolSizeMaximum(int jdbcPoolSizeMaximum)
+    {
+        this.jdbcPoolSizeMaximum = jdbcPoolSizeMaximum;
+    }
+
+    /**
+     * Returns if connections should be returned to the pool after use.
+     *
+     * Default: false
+     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.jdbcPoolPutConnections
+     *
+     * @deprecated I'm unused and should be removed.
+     * @return true if connections should be reused, false otherwise.
+     */
+    public boolean isJdbcPoolPutConnections()
+    {
+        return jdbcPoolPutConnections;
+    }
+
+    /**
+     * Sets if connections should be returned to the pool after use.
+     *
+     * @param jdbcPoolPutConnections true to enable connection reuse, false to disable.
+     */
+    public void setJdbcPoolPutConnections(boolean jdbcPoolPutConnections)
+    {
+        this.jdbcPoolPutConnections = jdbcPoolPutConnections;
+    }
+
+    /**
+     * Returns the share mode for the ObjectStore, i.e., is this being shared
+     * between VMs?
+     *
+     * Default: ObjectStore.OS_UNKNOWN
+     * Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.share
+     *
+     * @return the default share mode.
+     */
+    public int getShare()
+    {
+        return share;
+    }
+
+    /**
+     * Sets the share mode of the ObjectStore
+     *
+     * @param share a valid share mode.
+     */
+    public void setShare(int share)
+    {
+        this.share = share;
+    }
+}

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBeanMBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBeanMBean.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/JDBCStoreEnvironmentBeanMBean.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * 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) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
+
+/**
+ * A JMX MBean interface containing configuration for the JDBC based objectstore implementation.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com)
+ */
+public interface JDBCStoreEnvironmentBeanMBean
+{
+    String getJdbcUserDbAccess();
+
+    String getJdbcTxDbAccess();
+
+    int getJdbcPoolSizeInitial();
+
+    int getJdbcPoolSizeMaximum();
+
+    boolean isJdbcPoolPutConnections();
+
+    int getShare();
+}

Modified: 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	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/ibm_driver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -20,8 +20,6 @@
  */
 package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
 
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-
 import java.sql.Statement;
 import java.sql.SQLException;
 
@@ -29,7 +27,7 @@
  * JDBC store implementation driver-specific code.
  * This version for IBM DB2 Universal JDBC Drivers.
  */
-public class ibm_driver extends JDBCImple
+public class ibm_driver extends com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple
 {
     protected void createTable (Statement stmt, String tableName) throws SQLException
 	{

Modified: 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	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/jconnect_driver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -20,8 +20,6 @@
  */
 package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
 
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-
 import java.sql.Statement;
 import java.sql.SQLException;
 

Modified: 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/microsoft_driver.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/microsoft_driver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -40,8 +40,6 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-
 /**
  * JDBC store implementation driver-specific code.
  * This version for MS SQL Server JDBC Drivers 2 (server 2005/2008).

Modified: 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	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/mysql_ab_driver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -20,8 +20,6 @@
  */
 package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
 
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-
 import java.sql.Statement;
 import java.sql.SQLException;
 
@@ -29,7 +27,7 @@
  * JDBC store implementation driver-specific code.
  * This version for MySQL JDBC Drivers.
  */
-public class mysql_ab_driver extends JDBCImple
+public class mysql_ab_driver extends com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple
 {
     protected void createTable (Statement stmt, String tableName) throws SQLException
 	{

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	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/oracle_driver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -51,7 +51,6 @@
 import com.arjuna.ats.arjuna.state.InputObjectState;
 import com.arjuna.ats.arjuna.state.OutputObjectState;
 import com.arjuna.ats.arjuna.objectstore.StateStatus;
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
 import com.arjuna.ats.arjuna.logging.tsLogger;
 import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
 

Modified: 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	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/jdbc/postgresql_driver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -20,8 +20,6 @@
  */
 package com.arjuna.ats.internal.arjuna.objectstore.jdbc;
 
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
-
 import java.sql.Statement;
 import java.sql.SQLException;
 

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/JDBCObjectStoreTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/JDBCObjectStoreTest.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/JDBCObjectStoreTest.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -22,6 +22,7 @@
 
 import java.sql.SQLException;
 
+import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStoreEnvironmentBean;
 import org.junit.Test;
 
 import com.arjuna.ats.arjuna.common.Uid;
@@ -29,7 +30,6 @@
 import com.arjuna.ats.arjuna.objectstore.StateStatus;
 import com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess;
 import com.arjuna.ats.arjuna.state.OutputObjectState;
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
 import com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors.accessor;
 import com.hp.mwtests.ts.arjuna.resources.mock.MockAccessor;
 import com.hp.mwtests.ts.arjuna.resources.mock.MockConnection;
@@ -56,7 +56,7 @@
         
         imple.setValid(true);
         
-        assertTrue(imple.initialise(new MockConnection(), new MockAccessor(), "tableName"));
+        assertTrue(imple.initialise(new MockConnection(), new MockAccessor(), "tableName", new JDBCStoreEnvironmentBean()));
         
         imple.setState(StateStatus.OS_UNCOMMITTED);
         
@@ -169,11 +169,12 @@
         imple.addTable("tname");
         
         assertEquals(imple.getTheState("foo"), StateStatus.OS_UNKNOWN);
+
+        // TODO: fixme
+//        Uid key = new Uid();
+//        imple.addToTheCache(key, StateStatus.OS_COMMITTED);
+//        imple.removeFromTheCache(key);
         
-        imple.addToTheCache(null, StateStatus.OS_COMMITTED);
-        
-        imple.removeFromTheCache(null);
-        
         assertFalse(imple.retryConnection(new ObjectStoreException(), 0));
         
         assertTrue(imple.retryConnection(new SQLException(), 0));

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockDriver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockDriver.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockDriver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -38,35 +38,35 @@
 
 import com.arjuna.ats.arjuna.common.Uid;
 import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-import com.arjuna.ats.arjuna.objectstore.StateStatus;
-import com.arjuna.ats.arjuna.objectstore.StateType;
 import com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess;
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple;
+import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStoreEnvironmentBean;
 import com.arjuna.ats.internal.arjuna.objectstore.jdbc.ibm_driver;
 
 public class MockDriver extends ibm_driver
 {   
-    public boolean initialise(Connection conn, JDBCAccess jdbcAccess, String tableName) throws SQLException
+    public boolean initialise(Connection conn, JDBCAccess jdbcAccess, String tableName,
+                              JDBCStoreEnvironmentBean jdbcStoreEnvironmentBean) throws SQLException
     {
-        super.initialise(conn, jdbcAccess, tableName);
+        super.initialise(conn, jdbcAccess, tableName, jdbcStoreEnvironmentBean);
         
         super._poolSizeInit = 1;
         super._inUse = new boolean[1];
         super._theConnection = new Connection[1];
         super._preparedStatements = new PreparedStatement[1][];
         
-        super._preparedStatements[0] = new PreparedStatement[JDBCImple.STATEMENT_SIZE];
+        super._preparedStatements[0] = new PreparedStatement[com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.STATEMENT_SIZE];
         
-        super._preparedStatements[0][JDBCImple.READ_STATE] = new MockPreparedStatement(false);
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.READ_STATE] = new MockPreparedStatement(false);
         super._preparedStatements[0][JDBCImple.READ_WRITE_SHORTCUT] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.WRITE_STATE_NEW] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.SELECT_FOR_WRITE_STATE] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.PRECOMMIT_CLEANUP] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.COMMIT_STATE] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.CURRENT_STATE] = new MockPreparedStatement(false);
-        super._preparedStatements[0][JDBCImple.HIDE_STATE] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.WRITE_STATE_NEW] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.SELECT_FOR_WRITE_STATE] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.PRECOMMIT_CLEANUP] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.COMMIT_STATE] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.CURRENT_STATE] = new MockPreparedStatement(false);
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.HIDE_STATE] = new MockPreparedStatement();
         super._preparedStatements[0][JDBCImple.REVEAL_STATE] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.REMOVE_STATE] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.REMOVE_STATE] = new MockPreparedStatement();
         
         super._inUse[0] = false;
         super._theConnection[0] = new MockConnection();

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockOracleDriver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockOracleDriver.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/mock/MockOracleDriver.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -36,7 +36,7 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 
-import com.arjuna.ats.internal.arjuna.objectstore.JDBCImple;
+import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple;
 import com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_driver;
 
 
@@ -51,8 +51,8 @@
         super._preparedStatements[0] = new PreparedStatement[JDBCImple.STATEMENT_SIZE];
         
         super._preparedStatements[0][JDBCImple.READ_STATE] = new MockPreparedStatement(false);
-        super._preparedStatements[0][JDBCImple.READ_WRITE_SHORTCUT] = new MockPreparedStatement();
-        super._preparedStatements[0][JDBCImple.WRITE_STATE_NEW] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.READ_WRITE_SHORTCUT] = new MockPreparedStatement();
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.WRITE_STATE_NEW] = new MockPreparedStatement();
         super._preparedStatements[0][JDBCImple.SELECT_FOR_WRITE_STATE] = new MockPreparedStatement();
         
         super._inUse[0] = false;
@@ -68,7 +68,7 @@
     
     public void resetReadState ()
     {
-        super._preparedStatements[0][JDBCImple.READ_STATE] = new MockPreparedStatement(true);
+        super._preparedStatements[0][com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCImple.READ_STATE] = new MockPreparedStatement(true);
     }
     
     public void resetReadWriteShortcut ()

Modified: labs/jbosstm/trunk/qa/tests/product/src/com/arjuna/ats/tools/perftest/product/JBossTSProduct.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/product/src/com/arjuna/ats/tools/perftest/product/JBossTSProduct.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/qa/tests/product/src/com/arjuna/ats/tools/perftest/product/JBossTSProduct.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -38,10 +38,6 @@
 
     protected String getStoreType()
     {
-        if (arjPropertyManager.getCoordinatorEnvironmentBean().isTransactionLog()) {
-            return "LogStore";
-        }
-        
         String st = arjPropertyManager.getObjectStoreEnvironmentBean().getObjectStoreType();
 
         int ind = st.lastIndexOf('.') + 1;

Modified: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/EmptyObjectStore.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/EmptyObjectStore.java	2010-09-09 13:47:01 UTC (rev 35090)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/Utils/EmptyObjectStore.java	2010-09-09 14:28:08 UTC (rev 35091)
@@ -33,6 +33,7 @@
 
 import com.arjuna.ats.arjuna.common.arjPropertyManager;
 import com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess;
+import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStoreEnvironmentBean;
 
 import java.io.File;
 import java.sql.Connection;
@@ -68,7 +69,7 @@
 			if (arjPropertyManager.getObjectStoreEnvironmentBean().getObjectStoreType() != null &&
 					arjPropertyManager.getObjectStoreEnvironmentBean().getObjectStoreType().startsWith("JDBCStore"))
 			{
-				JDBCAccess mJDBC = (JDBCAccess) Class.forName(arjPropertyManager.getObjectStoreEnvironmentBean().getJdbcUserDbAccess()).newInstance();
+				JDBCAccess mJDBC = (JDBCAccess) Class.forName(new JDBCStoreEnvironmentBean().getJdbcUserDbAccess()).newInstance();
 				String tableName = mJDBC.tableName();
 				if (tableName == "")
 					/* from arjuna.internal.JDBCStore */



More information about the jboss-svn-commits mailing list