[teiid-commits] teiid SVN: r481 - in trunk: common-core/src/main/java/com/metamatrix/core/util and 51 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Feb 23 12:43:20 EST 2009


Author: shawkins
Date: 2009-02-23 12:43:19 -0500 (Mon, 23 Feb 2009)
New Revision: 481

Added:
   trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/AliasModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BindValueVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/EscapeSyntaxModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/FunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/TranslatedCommand.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/Translator.java
Removed:
   trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/pool/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionListener.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionQueryStrategy.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionStrategy.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/DefaultConnectionListener.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSingleIdentityConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUserIdentityConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/BindValueVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/FunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ResultsTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLConversionVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/TranslatedCommand.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ValueRetriever.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/impl/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm/MMSingleIdentityConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleResultsTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSingleIdentityConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleUserIdentityConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl/JDBCSequeLinkSingleIdentityConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSingleIdentityDSConnectionFactory.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCXAConnector.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestConnectionQueryStrategy.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/MockExampleConnectionFactory.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialResultsTranslator.java
   trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorServicePropertyNames.java
Modified:
   trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
   trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java
   trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java
   trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties
   trunk/connector-api/src/main/java/com/metamatrix/connector/api/Connection.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/api/ExecutionContext.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/ConnectorIdentity.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/ConnectorIdentityFactory.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/PoolAwareConnection.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/SingleIdentity.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/SingleIdentityFactory.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/UserIdentity.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/identity/UserIdentityFactory.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/internal/ConnectorPropertyNames.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/AccessSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2ConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2SQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbySQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/InformixSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ConcatFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ExtractFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LeftOrRightFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/Log10FunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/DatePartFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/ModFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/FunctionReplacementVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSourceXAConnection.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/XAJDBCPropertyNames.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access/TestAccessSQLTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2ConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2SqlTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/TestDerbyConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestDropFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql/TestMySQLTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestExtractFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestSubstringFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql/TestPostgreSQLTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/TestPerUserPool.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util/TestFunctionReplacementVisitor.java
   trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java
   trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Connector.java
   trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
   trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java
   trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnector.java
   trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/SourceConnectionFactory.java
   trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BaseSourceConnectionFactory.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java
   trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWrapper.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ExecutionContextImpl.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionPool.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionWrapper.java
   trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java
   trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
   trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
   trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java
   trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionPool.java
   trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionWrapper.java
   trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java
   trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
   trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java
   trunk/test-integration/src/test/resources/xml-vp/xmlvp.DEF
Log:
TEIID-164 TEIID-352 removing complexity from the JDBC connector.  targetting a scenario where only the translator, connector, and the capabilities should need to be overriden.  This is an intermediate check-in.  Identity management for connectors will be merged with the base api.

Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -42,6 +43,7 @@
 import com.metamatrix.core.CorePlugin;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.util.ArgCheck;
+import com.metamatrix.core.util.StringUtil;
 
 
 /**
@@ -938,4 +940,53 @@
 
         return bPass;
     }
+
+    public static void setBeanProperties(Object bean, Properties props, String prefix) {
+		// Move all prop names to lower case so we can use reflection to get
+	    // method names and look them up in the connection props.
+	    final Properties connProps = lowerCaseAllPropNames(props);
+	    final Method[] methods = bean.getClass().getMethods();
+	    for (int i = 0; i < methods.length; i++) {
+	        final Method method = methods[i];
+	        final String methodName = method.getName();
+	        // If setter ...
+	        if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
+	            // Get the property name
+	            final String propertyName = methodName.substring(3);    // remove the "set"
+	            String shortName = propertyName.toLowerCase();
+	            String propertyValue = null;
+	            if (prefix != null) {
+	            	propertyValue = connProps.getProperty(prefix + "." + shortName);
+	            } else {
+	            	propertyValue = connProps.getProperty(shortName);
+	            }
+	            if (propertyValue == null) {
+	            	continue;
+	            }
+                final Class<?> argType = method.getParameterTypes()[0];
+                try {
+                    final Object[] params = new Object[] {StringUtil.valueOf(propertyValue, argType)};
+                    method.invoke(bean, params);
+                } catch (Throwable e) {
+                	throw new InvalidPropertyException(propertyName, propertyValue, argType, e);
+                }
+	        }
+	    }
+	}
+
+	private static Properties lowerCaseAllPropNames(final Properties connectionProps) {
+	    final Properties lcProps = new Properties();
+	    final Iterator itr = connectionProps.keySet().iterator();
+	    while ( itr.hasNext() ) {
+	        final String name = (String) itr.next();
+	        Object propValue = connectionProps.get(name);
+	        if (propValue instanceof String) {
+	            // we're only interested in prop values of type String
+	            // here since we'll be looking for params to reflected methods
+	            lcProps.setProperty(name.toLowerCase(), (String)propValue);
+	        } // if
+	    }
+	    return lcProps;
+	}
+
 }

Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -983,7 +983,8 @@
      * @param type
      * @return
      */
-    public static <T> T valueOf(String value, Class<T> type){
+    @SuppressWarnings("unchecked")
+	public static <T> T valueOf(String value, Class<T> type){
     	
     	if(type == String.class) {
     		return (T) value;
@@ -992,7 +993,7 @@
     		return (T) Boolean.valueOf(value);
     	}
     	else if (type == Integer.class || type == Integer.TYPE) {
-    		return (T) Integer.valueOf(value);
+    		return (T) Integer.decode(value);
     	}
     	else if (type == Float.class || type == Float.TYPE) {
     		return (T) Float.valueOf(value);
@@ -1001,10 +1002,10 @@
     		return (T) Double.valueOf(value);
     	}
     	else if (type == Long.class || type == Long.TYPE) {
-    		return (T) Long.valueOf(value);
+    		return (T) Long.decode(value);
     	}
     	else if (type == Short.class || type == Short.TYPE) {
-    		return (T) Short.valueOf(value);
+    		return (T) Short.decode(value);
     	}
     	else if (type.isAssignableFrom(List.class)) {
     		return (T)new ArrayList<String>(Arrays.asList(value.split(","))); //$NON-NLS-1$

Modified: trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/vdb/api/DEFReaderWriter.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -37,6 +37,7 @@
 import org.jdom.Element;
 import org.jdom.JDOMException;
 
+import com.metamatrix.common.CommonPlugin;
 import com.metamatrix.common.config.api.ComponentType;
 import com.metamatrix.common.config.api.ConnectorBinding;
 import com.metamatrix.common.config.util.InvalidConfigurationElementException;
@@ -79,7 +80,7 @@
             loadConnectorBindings(vdbDefn, root);
             
         } catch (JDOMException e) {
-            throw new IOException("VDBDefnXMLHelper.Unable_to_read_defn_file");//$NON-NLS-1$
+            throw new IOException(CommonPlugin.Util.getString("VDBDefnXMLHelper.Unable_to_read_defn_file"));//$NON-NLS-1$
         } 
         return vdbDefn;
     }

Modified: trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties
===================================================================
--- trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/common-internal/src/main/resources/com/metamatrix/common/i18n.properties	2009-02-23 17:43:19 UTC (rev 481)
@@ -3097,3 +3097,5 @@
 
 BasicApplication.Failed_while_installing_service_of_type__1=Failed while installing service of type
 
+VDBDefnXMLHelper.Unable_to_read_defn_file=Unable to read DEF file.
+

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/api/Connection.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/api/Connection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/api/Connection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,9 +22,9 @@
 
 package com.metamatrix.connector.api;
 
+import com.metamatrix.connector.identity.PoolAwareConnection;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 
 /**
  * <p>Represents a connection to this connector.  A connection will be obtained

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,8 +27,8 @@
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
 import com.metamatrix.connector.internal.ConnectorPropertyNames;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
 
 public class ConnectorAnnotations {
 	

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/api/ExecutionContext.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/api/ExecutionContext.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/api/ExecutionContext.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -24,9 +24,9 @@
 
 import java.io.Serializable;
 
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
-import com.metamatrix.connector.pool.SingleIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
+import com.metamatrix.connector.identity.SingleIdentity;
 
 /**
  * The security context provides information about the user context in which

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,6 +22,7 @@
 
 package com.metamatrix.connector.basic;
 
+import com.metamatrix.connector.api.Connection;
 import com.metamatrix.connector.api.ConnectorCapabilities;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.Execution;
@@ -29,12 +30,11 @@
 import com.metamatrix.connector.api.ProcedureExecution;
 import com.metamatrix.connector.api.ResultSetExecution;
 import com.metamatrix.connector.api.UpdateExecution;
+import com.metamatrix.connector.identity.ConnectorIdentity;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IProcedure;
 import com.metamatrix.connector.language.IQueryCommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 
 /**
  * Provides a default implementation of a {@link PoolAwareConnection} for a Connector
@@ -44,7 +44,7 @@
  * {@link #createUpdateExecution(IProcedure, ExecutionContext, RuntimeMetadata)}
  * as necessary.
  */
-public abstract class BasicConnection implements PoolAwareConnection {
+public abstract class BasicConnection implements Connection {
 
 	@Override
 	public Execution createExecution(ICommand command,
@@ -70,26 +70,34 @@
 	public UpdateExecution createUpdateExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
 		throw new ConnectorException("Unsupported Execution");
 	}
-	
+		
 	@Override
 	public boolean isAlive() {
 		return true;
 	}
 	
 	@Override
+	public ConnectorCapabilities getCapabilities() {
+		return null;
+	}
+		
+    /**
+     * Called by the pool to indicate that the connection was returned to the pool.
+     * The actual close call will be made when the pool wants to purge this connection.
+     */	
 	public void closeCalled() {
 		
 	}
 	
-	@Override
+    /**
+     * Called by the pool when an existing connection is leased so that the underlying
+     * Connection may have it's identity switched to a different user.
+     * @param identity
+     * @throws ConnectorException
+     */
 	public void setConnectorIdentity(ConnectorIdentity context)
 			throws ConnectorException {
 		
 	}
 	
-	@Override
-	public ConnectorCapabilities getCapabilities() {
-		return null;
-	}
-	
 }

Deleted: trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.basic;
-
-import com.metamatrix.connector.api.Connector;
-
-public abstract class BasicConnector implements Connector {
-
-}

Added: trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java	                        (rev 0)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnector.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,7 @@
+package com.metamatrix.connector.basic;
+
+import com.metamatrix.connector.api.Connector;
+
+public abstract class BasicConnector implements Connector {
+
+}

Copied: trunk/connector-api/src/main/java/com/metamatrix/connector/identity (from rev 475, trunk/connector-api/src/main/java/com/metamatrix/connector/pool)

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/ConnectorIdentity.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/ConnectorIdentity.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/ConnectorIdentity.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,7 +22,7 @@
 
 /*
  */
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
 
 /**

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/ConnectorIdentityFactory.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/ConnectorIdentityFactory.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/ConnectorIdentityFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -20,7 +20,7 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/PoolAwareConnection.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/PoolAwareConnection.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/PoolAwareConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,7 +22,7 @@
 
 /*
  */
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
 import com.metamatrix.connector.api.Connection;
 import com.metamatrix.connector.api.ConnectorException;

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/SingleIdentity.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/SingleIdentity.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/SingleIdentity.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,20 +22,15 @@
 
 /*
  */
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
-import com.metamatrix.connector.api.ExecutionContext;
 
 /**
  * This class represents a single ConnectorIdentity. All the connections are treated the same.
  */
 public class SingleIdentity implements ConnectorIdentity {
 
-    /**
-     * Construct with a context
-     * @param context The context
-     */
-    public SingleIdentity(ExecutionContext context){
+    public SingleIdentity(){
     }
     
     /**

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/SingleIdentityFactory.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/SingleIdentityFactory.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/SingleIdentityFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -20,7 +20,7 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
@@ -30,7 +30,7 @@
 	@Override
 	public ConnectorIdentity createIdentity(ExecutionContext context)
 			throws ConnectorException {
-		return new SingleIdentity(context);
+		return new SingleIdentity();
 	}
 	
 }

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/UserIdentity.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/UserIdentity.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/UserIdentity.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -20,23 +20,26 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
-import com.metamatrix.connector.api.ExecutionContext;
 
 /**
- * This class represents a ConnectorIdentity based on user name. Connections are 
- * pooled based on user name.
+ * This class represents a ConnectorIdentity keyed on a username with
+ * a mapped identity
  */
 public class UserIdentity implements ConnectorIdentity {
-    private ExecutionContext context;
+	private String username;
+	private String mappedUser;
+	private String password;
     
     /**
      * Construct with a security context
      * @param context The context
      */
-    public UserIdentity(ExecutionContext context){
-        this.context = context;
+    public UserIdentity(String username, String mappedUser, String password){
+        this.username = username;
+        this.mappedUser = mappedUser;
+        this.password = password;
     }    
     
     /**
@@ -51,7 +54,7 @@
 
         if (obj instanceof UserIdentity) {
             UserIdentity that = (UserIdentity)obj;
-            return this.context.getUser().equals(that.context.getUser());
+            return username.equals(that.username);
         }
         
         return false;        
@@ -61,10 +64,18 @@
      * Get hash code, based on user name
      */
     public int hashCode(){
-        return context.getUser().hashCode();
+        return username.hashCode();
     }    
     
     public String toString(){
-        return "UserIdentity " + context.getUser(); //$NON-NLS-1$
+        return "UserIdentity " + username; //$NON-NLS-1$
     }  
+    
+    public String getMappedUser() {
+		return mappedUser;
+	}
+    
+    public String getPassword() {
+		return password;
+	}
 }

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/identity/UserIdentityFactory.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/pool/UserIdentityFactory.java	2009-02-16 21:35:28 UTC (rev 475)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/identity/UserIdentityFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -20,28 +20,57 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.pool;
+package com.metamatrix.connector.identity;
 
 import com.metamatrix.connector.DataPlugin;
 import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.CredentialMap;
 import com.metamatrix.connector.api.ExecutionContext;
 
 /**
- * Segregates connections by user.  It is assumed that no single identity
- * exists.
- * 
- * If multiple users use the same credentials, consider using a more specific
- * form of connector identity to prevent pool fragmentation. 
+ * Segregates connections by user determined by the CredentialMap.  
  */
 public class UserIdentityFactory implements ConnectorIdentityFactory {
 
+	private boolean useCredentialMap;
+	private boolean adminConnectionsAllowed = true;
+	private String connectorName;
+	
 	@Override
 	public ConnectorIdentity createIdentity(ExecutionContext context)
 			throws ConnectorException {
 		if (context == null) {
+			if (adminConnectionsAllowed) {
+				return new SingleIdentity();
+			}
 			throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.single_identity_not_supported")); //$NON-NLS-1$
 		}
-		return new UserIdentity(context);
+		Object payload = context.getTrustedPayload();
+		if (!(payload instanceof CredentialMap)) {
+			if (useCredentialMap) {
+				throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.single_identity_not_supported")); //$NON-NLS-1$
+			}
+			return new SingleIdentity();
+		}
+		CredentialMap credMap = (CredentialMap)payload;
+		String user = credMap.getUser(connectorName);
+		String password = credMap.getPassword(connectorName);
+		if (user == null || password == null) {
+			throw new ConnectorException("Payload missing credentials for " + connectorName); //$NON-NLS-1$
+		}
+		return new UserIdentity(context.getUser(), user, password);
 	}
 	
+	public void setConnectorName(String connectorName) {
+		this.connectorName = connectorName;
+	}
+	
+	public void setUseCredentialMap(boolean useCredentialMap) {
+		this.useCredentialMap = useCredentialMap;
+	}
+	
+	public void setAdminConnectionsAllowed(boolean adminConnectionsAllowed) {
+		this.adminConnectionsAllowed = adminConnectionsAllowed;
+	}
+	
 }

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/internal/ConnectorPropertyNames.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/internal/ConnectorPropertyNames.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/internal/ConnectorPropertyNames.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -81,42 +81,25 @@
     public static final String CONNECTOR_ID = "ConnectorID"; //$NON-NLS-1$
     
     /**
-     * The environment property used as a flag to deregister the driver
-     */
-    public static final String DEREGISTER_DRIVER = "deregisterDriver"; //$NON-NLS-1$
-    
-    /**
-     * The environment property used as a flag to deregister the driver by ClassLoader
-     */
-    public static final String DEREGISTER_BY_CLASSLOADER = "deregisterByClassLoader"; //$NON-NLS-1$
-    
-    /**
-     * The environment property used as a flag to deregister the driver by ClassName
-     */
-    public static final String DEREGISTER_BY_CLASSNAME = "deregisterByClassName"; //$NON-NLS-1$
-    
-    /**
-     * The environment property used to identify a class loader to load connector.
-     * The default class loader will be used if it is not defined.
-     * This is an optional property.
-     * @since 4.0
-     */
-    public static final String CONNECTOR_CLASS_LOADER = "ConnectorClassLoader"; //$NON-NLS-1$
-
-    /**
      * The name of the VM where the connector is running on.
      * @since 4.0
      */
     public static final String CONNECTOR_VM_NAME = "ConnectorVMName"; //$NON-NLS-1$
 
-    public static final String USE_RESULTSET_CACHE = "ResultSetCacheEnabled"; //$NON-NLS-1$
-    public static final String MAX_RESULTSET_CACHE_SIZE = "ResultSetCacheMaxSize"; //$NON-NLS-1$
-    public static final String MAX_RESULTSET_CACHE_AGE = "ResultSetCacheMaxAge"; //$NON-NLS-1$
-    public static final String RESULTSET_CACHE_SCOPE = "ResultSetCacheScope"; //$NON-NLS-1$
-
     /**
      * Indicates whether the connector represents a pooled resource.  If it does, then
      * synchronous workers will be used.
      */
     public static final String SYNCH_WORKERS = "SynchWorkers"; //$NON-NLS-1$
+    
+    public static final String USING_CUSTOM_CLASSLOADER = "UsingCustomClassloader"; //$NON-NLS-1$
+    
+    public static final String CONNECTOR_CLASSPATH = "ConnectorClassPath"; //$NON-NLS-1$
+    
+    public static final String IS_XA = "IsXA"; //$NON-NLS-1$
+    
+    public static final String USE_CREDENTIALS_MAPS = "UseCredentialMaps"; //$NON-NLS-1$
+    
+    public static final String ADMIN_CONNECTIONS_ALLOWED = "AdminConnectionsAllowed"; //$NON-NLS-1$
+
 }

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionListener.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionListener.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionListener.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Connection;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-
-/**
- * Connection listner for the life cycle events for the connection 
- */
-public interface ConnectionListener {
-    
-    /**
-     * This call will be invoked right after the connection to the datasource
-     * is open by the <code>JDBCConnectionFactory</code>. This will invoked every 
-     * connection in pool.
-     * @param connection
-     */
-    void afterConnectionCreation(Connection connection, ConnectorEnvironment env);
-    /**
-     * This call will be invoked just before the connection to the datasource
-     * is relased to the connection pool or closed, which ever action taken by
-     * the <code>JDBCConnectionFactory</code>  
-     * @param connection
-     */    
-    void beforeConnectionClose(Connection connection, ConnectorEnvironment env );
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionQueryStrategy.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionQueryStrategy.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionQueryStrategy.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-/**
- * Connection strategy that tests a connection by running a test query. 
- */
-public class ConnectionQueryStrategy implements ConnectionStrategy{
-    private String connTestquery;
-        
-    public ConnectionQueryStrategy(String query){
-        this.connTestquery = query;
-    }    
-    
-    /**
-     * @see com.metamatrix.connector.jdbc.ConnectionStrategy#isConnectionAlive()
-     */
-    public boolean isConnectionAlive(Connection connection) {
-        Statement statement = null;
-    	try {
-            if(connection.isClosed()){
-                return false;
-            } 
-            statement = connection.createStatement();
-            statement.executeQuery(connTestquery);
-        } catch(SQLException e) {
-        	return false;
-        } finally {
-            if ( statement != null ) {
-                try {
-                    statement.close();
-                    statement=null;
-                } catch ( SQLException e ) {
-                }
-            }
-        }
-        return true;
-    }
-    
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionStrategy.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionStrategy.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ConnectionStrategy.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Connection;
-
-public interface ConnectionStrategy {
-    
-    /**
-     * @return true if the connection is alive.  false if the connection is closed or failed. 
-     */
-    boolean isConnectionAlive(Connection connection);
-    
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/DefaultConnectionListener.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/DefaultConnectionListener.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/DefaultConnectionListener.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-
-/**
- * A default connection listener object, on a given connection factory. 
- * @author Ramesh Reddy
- */
-public class DefaultConnectionListener implements ConnectionListener {
-    //  Since this going to used inside a pool, we would like to report only once  
-    boolean alreadyReportedDetails = false;  
-
-    /**
-     * defect request 13979 & 13978
-     */
-    public void afterConnectionCreation(Connection connection, ConnectorEnvironment env) {
-        
-        if (alreadyReportedDetails) {
-            return;            
-        }
-        
-        alreadyReportedDetails = true;
-        // now dig some details about this driver/database for log.
-        try {
-            StringBuffer sb = new StringBuffer();
-            DatabaseMetaData dbmd = connection.getMetaData();
-            sb.append("Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
-            sb.append(";DatabaseProductName=").append(dbmd.getDatabaseProductName()); //$NON-NLS-1$
-            sb.append(";DatabaseProductVersion=").append(dbmd.getDatabaseProductVersion()); //$NON-NLS-1$
-            sb.append(";DriverMajorVersion=").append(dbmd.getDriverMajorVersion()); //$NON-NLS-1$
-            sb.append(";DriverMajorVersion=").append(dbmd.getDriverMinorVersion()); //$NON-NLS-1$
-            sb.append(";DriverName=").append(dbmd.getDriverName()); //$NON-NLS-1$
-            sb.append(";DriverVersion=").append(dbmd.getDriverVersion()); //$NON-NLS-1$
-            sb.append(";IsolationLevel=").append(dbmd.getDefaultTransactionIsolation()); //$NON-NLS-1$
-            
-            env.getLogger().logInfo(sb.toString());
-        } catch (SQLException e) {
-            String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_jdbc_connection_details"); //$NON-NLS-1$            
-            env.getLogger().logInfo(errorStr); 
-        }
-        
-    }
-
-    /**
-     * defect request 13979 & 13978
-     */
-    public void beforeConnectionClose(Connection connection, ConnectorEnvironment env) {
-    }
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -37,11 +37,10 @@
 import com.metamatrix.connector.api.ConnectorLogger;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.basic.BasicExecution;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.pool.ConnectorIdentity;
 
 /**
  */
@@ -53,8 +52,7 @@
 
     // Passed to constructor
     protected Connection connection;
-    protected SQLTranslator sqlTranslator;
-    protected ResultsTranslator resultsTranslator;
+    protected Translator sqlTranslator;
     protected ConnectorIdentity id;
     protected ConnectorLogger logger;
     protected ExecutionContext context;
@@ -71,14 +69,12 @@
     // ===========================================================================================================================
 
     protected JDBCBaseExecution(Connection connection,
-                                SQLTranslator sqlTranslator,
-                                ResultsTranslator resultsTranslator,
+                                Translator sqlTranslator,
                                 ConnectorLogger logger,
                                 Properties props,
                                 ExecutionContext context) {
         this.connection = connection;
         this.sqlTranslator = sqlTranslator;
-        this.resultsTranslator = resultsTranslator;
         this.logger = logger;
         this.context = context;
 
@@ -88,7 +84,7 @@
         }
         
         fetchSize = PropertiesUtils.getIntProperty(props, JDBCPropertyNames.FETCH_SIZE, context.getBatchSize());
-        int max = resultsTranslator.getMaxResultRows();
+        int max = sqlTranslator.getMaxResultRows();
         if (max > 0) {
         	fetchSize = Math.min(fetchSize, max);
         }
@@ -224,8 +220,8 @@
     }
 
     protected void setSizeContraints(Statement statement) throws SQLException {
-        if (resultsTranslator.getMaxResultRows() > 0) {
-            statement.setMaxRows(resultsTranslator.getMaxResultRows());
+        if (sqlTranslator.getMaxResultRows() > 0) {
+            statement.setMaxRows(sqlTranslator.getMaxResultRows());
         }
     	statement.setFetchSize(fetchSize);
     }
@@ -270,7 +266,7 @@
         return this.connection;
     }
     
-    public SQLTranslator getSqlTranslator() {
+    public Translator getSqlTranslator() {
 		return sqlTranslator;
 	}
     

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -24,66 +24,119 @@
  */
 package com.metamatrix.connector.jdbc;
 
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+import javax.sql.XADataSource;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.connector.DataPlugin;
 import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.api.Connector;
 import com.metamatrix.connector.api.ConnectorCapabilities;
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.CredentialMap;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.ConnectorAnnotations.ConnectionPooling;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
+import com.metamatrix.connector.identity.SingleIdentity;
+import com.metamatrix.connector.identity.UserIdentity;
+import com.metamatrix.connector.internal.ConnectorPropertyNames;
+import com.metamatrix.connector.jdbc.translator.Translator;
+import com.metamatrix.connector.jdbc.xa.JDBCSourceXAConnection;
+import com.metamatrix.connector.jdbc.xa.XAJDBCPropertyNames;
+import com.metamatrix.connector.xa.api.TransactionContext;
+import com.metamatrix.connector.xa.api.XAConnection;
+import com.metamatrix.connector.xa.api.XAConnector;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
 
 /**
  * JDBC implementation of Connector interface.
  */
 @ConnectionPooling
-public class JDBCConnector implements Connector, ConnectorIdentityFactory {
-    protected ConnectorEnvironment environment;
+public class JDBCConnector implements XAConnector, ConnectorIdentityFactory {
+	
+    public static final String INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS = "28000"; //$NON-NLS-1$
+
+	static final int NO_ISOLATION_LEVEL_SET = Integer.MIN_VALUE;
+
+	enum TransactionIsolationLevel {
+        TRANSACTION_READ_UNCOMMITTED(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED),
+        TRANSACTION_READ_COMMITTED(java.sql.Connection.TRANSACTION_READ_COMMITTED),
+        TRANSACTION_REPEATABLE_READ(java.sql.Connection.TRANSACTION_REPEATABLE_READ),
+        TRANSACTION_SERIALIZABLE(java.sql.Connection.TRANSACTION_SERIALIZABLE),
+        TRANSACTION_NONE(java.sql.Connection.TRANSACTION_NONE);
+
+        private int connectionContant;
+
+        private TransactionIsolationLevel(int connectionConstant) {
+			this.connectionContant = connectionConstant;
+		}
+        
+        public int getConnectionConstant() {
+        	return connectionContant;
+        }
+	}
+	
+	protected ConnectorEnvironment environment;
     private ConnectorLogger logger;
-    private JDBCSourceConnectionFactory factory;
     private ConnectorCapabilities capabilities;
+    private Translator sqlTranslator;
+    private DataSource ds;
+    private XADataSource xaDs;
+    private int transIsoLevel = NO_ISOLATION_LEVEL_SET;
     
-	static ConnectorCapabilities createCapabilities(ConnectorEnvironment environment, ClassLoader loader)
+	private boolean useCredentialMap;
+	private boolean adminConnectionsAllowed = true;
+	private String connectorName;
+	
+	@Override
+	public ConnectorIdentity createIdentity(ExecutionContext context)
 			throws ConnectorException {
-		//create Capabilities
-        String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS);  
-        if(className == null){
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnection.Property_{0}_is_required,_but_not_defined_1", JDBCPropertyNames.EXT_CAPABILITY_CLASS)); //$NON-NLS-1$
-        }
-        
-        try {
-            Class capabilitiesClass = loader.loadClass(className);
-			ConnectorCapabilities result = (ConnectorCapabilities) capabilitiesClass.newInstance();
-	        if(result instanceof JDBCCapabilities) {
-	            String setCriteriaBatchSize = environment.getProperties().getProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE);
-	            if(setCriteriaBatchSize != null) {
-	                int maxInCriteriaSize = Integer.parseInt(setCriteriaBatchSize);
-	                if(maxInCriteriaSize > 0) {
-	                    ((JDBCCapabilities)result).setMaxInCriteriaSize(maxInCriteriaSize);
-	                }
-	            } 
-	        }
-	        return result;
-		} catch (Exception e) {
-			throw new ConnectorException(e);
+		if (context == null) {
+			if (adminConnectionsAllowed) {
+				return new SingleIdentity();
+			}
+			throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.single_identity_not_supported")); //$NON-NLS-1$
 		}
+		Object payload = context.getTrustedPayload();
+		if (!(payload instanceof CredentialMap)) {
+			if (useCredentialMap) {
+				throw new ConnectorException(JDBCPlugin.Util.getString("JDBCUserIdentityConnectionFactory.Unable_to_get_credentials")); //$NON-NLS-1$
+			}
+			return new SingleIdentity();
+		}
+		CredentialMap credMap = (CredentialMap)payload;
+		String user = credMap.getUser(connectorName);
+		String password = credMap.getPassword(connectorName);
+		if (user == null || password == null) {
+			throw new ConnectorException("Payload missing credentials for " + connectorName); //$NON-NLS-1$
+		}
+		return new UserIdentity(context.getUser(), user, password);
 	}
-
-    public void stop() {     
-        cleanUp();
-                
-        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_stopped._3")); //$NON-NLS-1$
-    }
+	
+	public void setConnectorName(String connectorName) {
+		this.connectorName = connectorName;
+	}
+	
+	public void setUseCredentialMap(boolean useCredentialMap) {
+		this.useCredentialMap = useCredentialMap;
+	}
+	
+	public void setAdminConnectionsAllowed(boolean adminConnectionsAllowed) {
+		this.adminConnectionsAllowed = adminConnectionsAllowed;
+	}
     
-    public void cleanUp() {
-        //Shutdown Factory
-        if(this.factory != null) {
-            this.factory.shutdown();
-        }
-    }
-
     @Override
     public void start(ConnectorEnvironment environment)
     		throws ConnectorException {
@@ -93,42 +146,289 @@
         logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$NON-NLS-1$
         
         capabilities = createCapabilities(environment, Thread.currentThread().getContextClassLoader());
-        String scfClassName = environment.getProperties().getProperty(JDBCPropertyNames.EXT_CONNECTION_FACTORY_CLASS, "com.metamatrix.connector.jdbc.JDBCSingleIdentityConnectionFactory");  //$NON-NLS-1$
 
+        Properties connectionProps = environment.getProperties();
+
+        // Get the JDBC properties ...
+        String dataSourceClassName = connectionProps.getProperty(JDBCPropertyNames.CONNECTION_SOURCE_CLASS);
+        
+        // Verify required items
+        if (dataSourceClassName == null || dataSourceClassName.trim().length() == 0) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_driver_class_name_1")); //$NON-NLS-1$
+        }
+        dataSourceClassName = dataSourceClassName.trim();
+
+        String levelStr = connectionProps.getProperty(JDBCPropertyNames.TRANSACTION_ISOLATION_LEVEL);
+        
+        if(levelStr != null && levelStr.trim().length() != 0){
+        	transIsoLevel = TransactionIsolationLevel.valueOf(levelStr.toUpperCase()).getConnectionConstant();
+        }
+        
         try {
-            //create source connection factory
-            Class scfClass = Thread.currentThread().getContextClassLoader().loadClass(scfClassName);
-            this.factory = (JDBCSourceConnectionFactory) scfClass.newInstance();
-            factory.initialize(environment);
-        } catch (ClassNotFoundException e1) {
-            throw new ConnectorException(e1);
-        } catch (InstantiationException e2) {
-            throw new ConnectorException(e2);
-        } catch (IllegalAccessException e3) {
-            throw new ConnectorException(e3);
-        } catch (ConnectorException e5) {
-            this.cleanUp();
-            throw e5;
+            String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_TRANSLATOR_CLASS, Translator.class.getName());  
+            this.sqlTranslator = (Translator)ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
+        } catch (MetaMatrixCoreException e) {
+            throw new ConnectorException(e);
         }
+        sqlTranslator.initialize(environment);
+        
+        if (this.adminConnectionsAllowed) {
+        	testConnection();
+        }
 
         logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_started._4")); //$NON-NLS-1$
     }
+    
+    private void testConnection() throws ConnectorException {
+    	Connection connection = null;
+        try {
+            connection = getConnection(null);
+        } catch (ConnectorException e) {
+            SQLException ex = (SQLException)e.getCause();
+            String sqlState = ex.getSQLState();
+            if (sqlState != null && INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS.equals(sqlState)) {
+                throw e;
+            }
+            this.logger.logError(e.getMessage(), e);
+        } finally {
+        	if (connection != null) {
+        		connection.close();
+        	}
+        }
+    }
+    
+	@Override
+    public void stop() {     
+		/*
+		 * attempt to deregister drivers that may have been implicitly registered
+		 * with the driver manager
+		 */
+        Enumeration drivers = DriverManager.getDrivers();
 
-    /*
-     * @see com.metamatrix.data.Connector#getConnection(com.metamatrix.data.SecurityContext)
-     */
+        String driverClassname = this.environment.getProperties().getProperty(JDBCPropertyNames.CONNECTION_SOURCE_CLASS);
+        boolean usingCustomClassLoader = PropertiesUtils.getBooleanProperty(this.environment.getProperties(), ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER, false);
+
+        while(drivers.hasMoreElements()){
+        	Driver tempdriver = (Driver)drivers.nextElement();
+            if(tempdriver.getClass().getClassLoader() != this.getClass().getClassLoader()) {
+            	continue;
+            }
+            if(usingCustomClassLoader || tempdriver.getClass().getName().equals(driverClassname)) {
+                try {
+                    DriverManager.deregisterDriver(tempdriver);
+                } catch (Throwable e) {
+                    this.environment.getLogger().logError(e.getMessage());
+                }
+            }
+        }
+                
+        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_stopped._3")); //$NON-NLS-1$
+    }
+    
+	@Override
     public Connection getConnection(ExecutionContext context) throws ConnectorException {
-    	return factory.getConnection(context);
+		DataSource dataSource = getDataSource();
+		if (dataSource == null) {
+			return getXAConnection(context, null);
+		}
+		java.sql.Connection conn = null;
+		try { 
+			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
+				conn = dataSource.getConnection();
+			} else if (context.getConnectorIdentity() instanceof UserIdentity) {
+				UserIdentity id = (UserIdentity)context.getConnectorIdentity();
+				conn = dataSource.getConnection(id.getMappedUser(), id.getPassword());
+			}
+			setDefaultTransactionIsolationLevel(conn);
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		}
+		return new JDBCSourceConnection(conn, this.environment, sqlTranslator);
     }
+	
+	@Override
+	public XAConnection getXAConnection(
+			ExecutionContext context,
+			TransactionContext transactionContext) throws ConnectorException {
+		XADataSource xaDataSource = getXADataSource();
+		if (xaDataSource == null) {
+			throw new UnsupportedOperationException("Connector is not XA capable");
+		}
+		javax.sql.XAConnection conn = null;
+		try {
+			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
+				conn = xaDataSource.getXAConnection();
+			} else if (context.getConnectorIdentity() instanceof UserIdentity) {
+				UserIdentity id = (UserIdentity)context.getConnectorIdentity();
+				conn = xaDataSource.getXAConnection(id.getMappedUser(), id.getPassword());
+			}
+			java.sql.Connection c = conn.getConnection();
+			setDefaultTransactionIsolationLevel(c);
+			return new JDBCSourceXAConnection(c, conn, this.environment, sqlTranslator);
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		}
+	}
 
     @Override
 	public ConnectorCapabilities getCapabilities() {
 		return capabilities;
 	}
 
-	@Override
-	public ConnectorIdentity createIdentity(ExecutionContext context)
-			throws ConnectorException {
-		return factory.createIdentity(context);
+	static ConnectorCapabilities createCapabilities(ConnectorEnvironment environment, ClassLoader loader)
+		throws ConnectorException {
+		//create Capabilities
+		String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, JDBCCapabilities.class.getName());  
+		try {
+		    ConnectorCapabilities result = (ConnectorCapabilities)ReflectionHelper.create(className, null, loader);
+		    if(result instanceof JDBCCapabilities) {
+		        String setCriteriaBatchSize = environment.getProperties().getProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE);
+		        if(setCriteriaBatchSize != null) {
+		            int maxInCriteriaSize = Integer.parseInt(setCriteriaBatchSize);
+		            if(maxInCriteriaSize > 0) {
+		                ((JDBCCapabilities)result).setMaxInCriteriaSize(maxInCriteriaSize);
+		            }
+		        } 
+		    }
+		    return result;
+		} catch (Exception e) {
+			throw new ConnectorException(e);
+		}
 	}
+	
+    protected void createDataSources(String dataSourceClassName, final Properties connectionProps) throws ConnectorException {
+        // create data source
+        Object temp = null;
+        try {
+        	temp = ReflectionHelper.create(dataSourceClassName, null, Thread.currentThread().getContextClassLoader());
+        } catch (MetaMatrixCoreException e) {
+    		throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", dataSourceClassName)); //$NON-NLS-1$
+    	}
+
+        final String url = connectionProps.getProperty(JDBCPropertyNames.URL);
+        if (url == null || url.trim().length() == 0) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
+        }
+        
+    	if (temp instanceof Driver) {
+    		final Driver driver = (Driver)temp;
+    		// check URL if there is one
+            validateURL(driver, url);
+    		this.ds = (DataSource)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {DataSource.class}, new InvocationHandler() {
+    			@Override
+    			public Object invoke(Object proxy, Method method,
+    					Object[] args) throws Throwable {
+    				if (method.getName().equals("getConnection")) {
+    					Properties p = new Properties();
+    					if (args.length == 2) {
+    						p.put("user", args[0]);
+    						p.put("password", args[1]);
+    					} else {
+    						p.put("user", connectionProps.getProperty(JDBCPropertyNames.USERNAME));
+    						p.put("password", connectionProps.getProperty(JDBCPropertyNames.PASSWORD));
+    					}
+    					return driver.connect(url, p);
+    				} 
+    				throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections");
+    			}
+    		});
+    	} else {
+    		parseURL(url, connectionProps);
+    		if (temp instanceof DataSource) {
+	    		this.ds = (DataSource)temp;
+	            PropertiesUtils.setBeanProperties(this.ds, connectionProps, null);
+    		} else if (temp instanceof XADataSource) {
+    			this.xaDs = (XADataSource)temp;
+    	        PropertiesUtils.setBeanProperties(this.xaDs, connectionProps, null);
+    		} else {
+    			throw new ConnectorException("Specified class is not a XADataSource, DataSource, or Driver " + dataSourceClassName);
+    		}
+    	} 
+    	if (this.ds instanceof XADataSource) {
+    		this.xaDs = (XADataSource)this.ds;
+    	}
+    }
+    
+    public DataSource getDataSource() {
+    	return ds;
+    }
+    
+    public XADataSource getXADataSource() {
+		return xaDs;
+	}
+        
+    private void validateURL(Driver driver, String url) throws ConnectorException {
+        boolean acceptsURL = false;
+        try {
+            acceptsURL = driver.acceptsURL(url);
+        } catch ( SQLException e ) {
+            throw new ConnectorException(e);
+        }
+        if(!acceptsURL ){
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Driver__7", driver.getClass().getName(), url)); //$NON-NLS-1$
+        }
+    }
+    
+    /**
+     * Parse URL for DataSource connection properties and add to connectionProps.
+     * @param url
+     * @param connectionProps
+     * @throws ConnectorException 
+     */
+    static void parseURL(final String url, final Properties connectionProps) throws ConnectorException {
+        // Will be: [jdbc:mmx:dbType://aHost:aPort], [DatabaseName=aDataBase], [CollectionID=aCollectionID], ...
+        final String[] urlParts = url.split(";"); //$NON-NLS-1$
+
+        // Will be: [jdbc:mmx:dbType:], [aHost:aPort]
+        final String[] protoHost = urlParts[0].split("//"); //$NON-NLS-1$
+
+        // Will be: [aHost], [aPort]
+        final String[] hostPort = protoHost[1].split(":"); //$NON-NLS-1$
+        connectionProps.setProperty(XAJDBCPropertyNames.SERVER_NAME, (String)hostPort[0]);
+        connectionProps.setProperty(XAJDBCPropertyNames.PORT_NUMBER, (String)hostPort[1]);
+
+        // For "databaseName", "SID", and all optional props
+        // (<propName1>=<propValue1>;<propName2>=<propValue2>;...)
+        for ( int i = 1; i < urlParts.length; i++ ) {
+            final String nameVal = (String) urlParts[i];
+            // Will be: [propName], [propVal]
+            final String[] aProp = nameVal.split("="); //$NON-NLS-1$
+            if ( aProp.length > 1) {
+                // Set optional prop names lower case so that we can find
+                // set method names for them when we introspect the DataSource
+                connectionProps.setProperty(aProp[0].toLowerCase(), aProp[1]);
+            }
+        }
+        
+        String serverName = connectionProps.getProperty(XAJDBCPropertyNames.SERVER_NAME);
+        String serverPort = connectionProps.getProperty(XAJDBCPropertyNames.PORT_NUMBER);
+    	if ( serverName == null || serverName.trim().length() == 0 ) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
+                    XAJDBCPropertyNames.SERVER_NAME));
+        }
+        if ( serverPort == null || serverPort.trim().length() == 0 ) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
+                    XAJDBCPropertyNames.PORT_NUMBER));
+        }
+        
+     // Unique resource name for this connector
+        final StringBuffer dataSourceResourceName = new StringBuffer(connectionProps.getProperty(XAJDBCPropertyNames.DATASOURCE_NAME, "XADS")); //$NON-NLS-1$
+        dataSourceResourceName.append('_'); 
+        dataSourceResourceName.append(serverName);
+        dataSourceResourceName.append('_'); 
+        dataSourceResourceName.append(connectionProps.getProperty(ConnectorPropertyNames.CONNECTOR_ID));
+        connectionProps.setProperty( XAJDBCPropertyNames.DATASOURCE_NAME, dataSourceResourceName.toString());
+    }
+    
+    public int getDefaultTransactionIsolationLevel() {
+        return this.transIsoLevel;
+    }
+    
+	protected void setDefaultTransactionIsolationLevel(java.sql.Connection sqlConn)
+			throws SQLException {
+		if(getDefaultTransactionIsolationLevel() != NO_ISOLATION_LEVEL_SET && getDefaultTransactionIsolationLevel() != java.sql.Connection.TRANSACTION_NONE){
+		    sqlConn.setTransactionIsolation(getDefaultTransactionIsolationLevel());
+		}
+	}
+        
 }

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -38,10 +38,8 @@
 import com.metamatrix.connector.api.DataNotAvailableException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.ProcedureExecution;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
-import com.metamatrix.connector.jdbc.extension.ValueRetriever;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.jdbc.util.JDBCExecutionHelper;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IParameter;
@@ -61,20 +59,18 @@
     /**
      * @param connection
      * @param sqlTranslator
-     * @param resultsTranslator
-     * @param id
      * @param logger
      * @param props
+     * @param id
      */
     public JDBCProcedureExecution(ICommand command,
         Connection connection,
-        SQLTranslator sqlTranslator,
-        ResultsTranslator resultsTranslator,
+        Translator sqlTranslator,
         ConnectorLogger logger,
-        Properties props, RuntimeMetadata metadata,
-        ExecutionContext context,
+        Properties props,
+        RuntimeMetadata metadata, ExecutionContext context,
         ConnectorEnvironment env) {
-        super(command, connection, sqlTranslator, resultsTranslator, logger, props, context, env);
+        super(command, connection, sqlTranslator, logger, props, context, env);
         this.metadata = metadata;
     }
 
@@ -92,7 +88,7 @@
             //create parameter index map
             parameterIndexMap = createParameterIndexMap(procedure.getParameters(), sql);
             CallableStatement cstmt = getCallableStatement(sql);
-            results = resultsTranslator.executeStoredProcedure(cstmt, translatedComm);
+            results = sqlTranslator.executeStoredProcedure(cstmt, translatedComm);
             if (results != null) {
             	initResultSetInfo();
             }
@@ -191,12 +187,11 @@
             throw new ConnectorException(JDBCPlugin.Util.getString("JDBCProcedureExecution.Unexpected_exception_1")); //$NON-NLS-1$
         }
         try {
-        	ValueRetriever valueRetriver = this.resultsTranslator.getValueRetriever();
-        	Object value = valueRetriver.retrieveValue((CallableStatement)this.statement, index.intValue(), parameter.getType(), calendar, env.getTypeFacility());
+        	Object value = sqlTranslator.retrieveValue((CallableStatement)this.statement, index.intValue(), parameter.getType());
             if(value == null){
                 return null;
             }
-            Object result = JDBCExecutionHelper.convertValue(value, parameter.getType(), this.resultsTranslator.getValueTranslators(), this.resultsTranslator.getTypeFacility(), trimString, context);
+            Object result = JDBCExecutionHelper.convertValue(value, parameter.getType(), this.sqlTranslator.getValueTranslators(), this.sqlTranslator.getTypeFacility(), trimString, context);
             return result;
         } catch (SQLException e) {
             throw new ConnectorException(e);

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -23,21 +23,13 @@
 package com.metamatrix.connector.jdbc;
 
 public class JDBCPropertyNames {
-    public static final String DRIVER_CLASS = "Driver"; //$NON-NLS-1$
+    public static final String CONNECTION_SOURCE_CLASS = "Driver"; //$NON-NLS-1$
     public static final String URL = "URL"; //$NON-NLS-1$
     public static final String USERNAME = "User"; //$NON-NLS-1$
     public static final String PASSWORD = "Password"; //$NON-NLS-1$
-    public static final String MAX_SQL_LENGTH = "MaxSQLLength"; //$NON-NLS-1$
 
     /**
     * This is the property name of the ConnectorService property that defines
-    * what character, if any, will be used to wrap date type of criteria values
-    * in SQL statements submitted to the data source.
-    */
-    public static final String DATE_WRAP_CHAR = "DateWrapChar"; //$NON-NLS-1$
-
-    /**
-    * This is the property name of the ConnectorService property that defines
     * whether or not String type values in Criteria statements in SQL queries to
     * the data source should have spaces trimmed from them.
     */
@@ -61,20 +53,6 @@
     public static final String TRANSACTION_ISOLATION_LEVEL = "TransactionIsolationLevel"; //$NON-NLS-1$
 
     /**
-      * This property can be used to specify a limit on the size of Blobs, in bytes, that 
-      * will be retrieved from a source.
-      * @since 3.0 
-      */
-     public static final String MAX_BLOB_BYTES = "MaxBlobBytes";    //$NON-NLS-1$
-
-     /**
-      * This property can be used to specify a limit on the size of Clobs, in characters, that 
-      * will be retrieved from a source.
-      * @since 3.0 
-      */
-     public static final String MAX_CLOB_CHARS= "MaxClobChars"; //$NON-NLS-1$
-
-    /**
      * This is the property name of the ConnectorService property that defines
      * the time zone of the source database.  This property should only be used in 
      * cases where the source database is in a different time zone than the 
@@ -92,23 +70,11 @@
 
     /**
      * This property is used to specify the implementation of
-     * com.metamatrix.connector.jdbc.extension.SQLTranslator
+     * com.metamatrix.connector.jdbc.extension.Translator
      */
-    public static final String EXT_SQL_TRANSLATOR_CLASS= "ExtensionSQLTranslationClass"; //$NON-NLS-1$
+    public static final String EXT_TRANSLATOR_CLASS= "ExtensionTranslationClass"; //$NON-NLS-1$
 
     /**
-     * This property is used to specify the implementation of
-     * com.metamatrix.connector.jdbc.extension.ResultsTranslator. 
-     */
-    public static final String EXT_RESULTS_TRANSLATOR_CLASS= "ExtensionResultsTranslationClass"; //$NON-NLS-1$
-
-    /**
-     * This property is used to specify the implementation of
-     * com.metamatrix.data.pool.SourceConnectionFactory
-     */
-    public static final String EXT_CONNECTION_FACTORY_CLASS= "ExtensionConnectionFactoryClass"; //$NON-NLS-1$
-    
-    /**
      * This property can be used to specify the fetch size used from the connector to
      * its underlying source.
      */
@@ -126,5 +92,10 @@
      * This property is used to turn on/off the use of the default comments like
      * connection id and requestid in the source SQL query.
      */
-    public static final String USE_COMMENTS_SOURCE_QUERY= "UseCommentsInSourceQuery";    //$NON-NLS-1$
+    public static final String USE_COMMENTS_SOURCE_QUERY= "UseCommentsInSourceQuery";    //$NON-NLS-1$    
+    
+    public static final String CONNECTION_TEST_QUERY = "ConnectionTestQuery"; //$NON-NLS-1$
+    
+    public static final String IS_VALID_TIMEOUT = "IsValidTimeout"; //$NON-NLS-1$
+
 }

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -32,10 +32,8 @@
 import java.sql.SQLException;
 import java.sql.Types;
 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.List;
 import java.util.Properties;
-import java.util.TimeZone;
 
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
@@ -45,9 +43,8 @@
 import com.metamatrix.connector.api.ResultSetExecution;
 import com.metamatrix.connector.api.TypeFacility;
 import com.metamatrix.connector.api.ValueTranslator;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.jdbc.util.JDBCExecutionHelper;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IQueryCommand;
@@ -63,7 +60,6 @@
 
     protected ResultSet results;
     protected Class[] columnDataTypes;
-    protected Calendar calendar;
     protected ConnectorEnvironment env;
     protected ICommand command;
 	private boolean[] transformKnown;
@@ -76,22 +72,13 @@
     // ===========================================================================================================================
 
     public JDBCQueryExecution(ICommand command, Connection connection,
-                              SQLTranslator sqlTranslator,
-                              ResultsTranslator resultsTranslator,
+                              Translator sqlTranslator,
                               ConnectorLogger logger,
                               Properties props,
                               ExecutionContext context,
                               ConnectorEnvironment env) {
-        super(connection, sqlTranslator, resultsTranslator, logger, props, context);
+        super(connection, sqlTranslator, logger, props, context);
         this.command = command;
-        TimeZone dbmsTimeZone = resultsTranslator.getDatabaseTimezone();
-
-        if (dbmsTimeZone != null) {
-            calendar = Calendar.getInstance(dbmsTimeZone);
-        } else {
-            calendar = Calendar.getInstance();
-        }
-        
         this.env = env;
     }
     
@@ -111,7 +98,7 @@
                 results = getStatement().executeQuery(sql);
             } else {
             	PreparedStatement pstatement = getPreparedStatement(sql);
-                resultsTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
+                sqlTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
                 results = pstatement.executeQuery();
             } 
             addStatementWarnings();
@@ -154,13 +141,13 @@
 
                 for (int i = 0; i < columnDataTypes.length; i++) {
                     // Convert from 0-based to 1-based
-                    Object value = resultsTranslator.getValueRetriever().retrieveValue(results, i+1, columnDataTypes[i], calendar, env.getTypeFacility());
+                    Object value = sqlTranslator.retrieveValue(results, i+1, columnDataTypes[i]);
                     if(value != null) {
                         // Determine transformation if unknown
                         if(! transformKnown[i]) {
                             Class valueType = value.getClass();
                             if(!columnDataTypes[i].isAssignableFrom(valueType)) {
-                                transforms[i] = JDBCExecutionHelper.determineTransformation(valueType, columnDataTypes[i], resultsTranslator.getValueTranslators(), resultsTranslator.getTypeFacility());
+                                transforms[i] = JDBCExecutionHelper.determineTransformation(valueType, columnDataTypes[i], sqlTranslator.getValueTranslators(), sqlTranslator.getTypeFacility());
                             }
                             transformKnown[i] = true;
                         }

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSingleIdentityConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSingleIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSingleIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Driver;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.SingleIdentityFactory;
-
-/**
- * Factory to create JDBCSourceConnection for SingleIdentity.
- */
-public class JDBCSingleIdentityConnectionFactory extends JDBCSourceConnectionFactory {
-    public static final String INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS = "28000"; //$NON-NLS-1$
-    private Driver driver;
-    private String url;
-    private int transIsoLevel;
-    private Properties userProps;
-    protected ConnectionListener connectionListener = new DefaultConnectionListener();
-    private ConnectorLogger logger;
-
-    public JDBCSingleIdentityConnectionFactory() {
-		super(new SingleIdentityFactory());
-	}
-    
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
-        super.initialize(env);
-        verifyConnectionProperties(env.getProperties());
-        logger = env.getLogger();
-        // attempt to get a connection to verify that properties are valid
-        testConnection();
-    }
-    
-    protected void verifyConnectionProperties(Properties connectionProps) throws ConnectorException{
-        // Find driver 
-        String driverClassName = connectionProps.getProperty(JDBCPropertyNames.DRIVER_CLASS);
-        driver = createDriver(driverClassName);
-
-        // check URL
-        url = connectionProps.getProperty(JDBCPropertyNames.URL);
-        validateURL(driver, url);
-
-        // Build connection properties from user name and password
-        String username = connectionProps.getProperty(JDBCPropertyNames.USERNAME);
-        String password = connectionProps.getProperty(JDBCPropertyNames.PASSWORD);
-        userProps = new Properties();
-        if (username != null && username.trim().length() > 0) {
-            userProps.setProperty("user", username.trim()); //$NON-NLS-1$
-        }
-
-        if ( password != null && password.trim().length() > 0 ) {
-            userProps.setProperty("password", password.trim()); //$NON-NLS-1$
-        }
-        
-        transIsoLevel = interpretTransactionIsolationLevel( connectionProps.getProperty(JDBCPropertyNames.TRANSACTION_ISOLATION_LEVEL));        
-    }
-    
-    private void testConnection() throws ConnectorException {
-        try {
-            Connection connection = getConnection(null);
-            connection.close();
-        } catch (ConnectorException e) {
-            SQLException ex = (SQLException)e.getCause();
-            String sqlState = ex.getSQLState();
-            if (sqlState != null && INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS.equals(sqlState)) {
-                throw e;
-            }
-            this.logger.logError(e.getMessage(), e);
-        }           
-    }
-            
-    public Connection getConnection(ExecutionContext ctx) throws ConnectorException {
-        return createJDBCConnection(driver, url, transIsoLevel, userProps);
-    }
-
-    protected int getTransactionIsolation(){
-        return this.transIsoLevel;
-    }
-    
-    /**
-     * Connection Listener only used in the SingleIdentityConnections for now.
-     * @see com.metamatrix.connector.jdbc.JDBCSourceConnectionFactory#getConnectionListener()
-     */
-    protected ConnectionListener getConnectionListener() {
-        return connectionListener;
-    }
-    
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -24,7 +24,9 @@
  */
 package com.metamatrix.connector.jdbc;
 
+import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.Statement;
 
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
@@ -34,91 +36,91 @@
 import com.metamatrix.connector.api.ResultSetExecution;
 import com.metamatrix.connector.api.UpdateExecution;
 import com.metamatrix.connector.basic.BasicConnection;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IProcedure;
 import com.metamatrix.connector.language.IQueryCommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 
 /**
  * 
  */
-public class JDBCSourceConnection extends BasicConnection implements PoolAwareConnection {
+public class JDBCSourceConnection extends BasicConnection {
     protected java.sql.Connection physicalConnection;
     protected ConnectorEnvironment environment;
     private ConnectorLogger logger;
-    private ConnectionStrategy connectionStrategy;
-    private ConnectionListener connectionListener;
-    private SQLTranslator sqlTranslator;
-    private ResultsTranslator resultsTranslator;
+    private Translator sqlTranslator;
 
-    /**
-     * @param connection
-     */
-    public JDBCSourceConnection(java.sql.Connection connection, ConnectorEnvironment environment, ConnectionStrategy connectionStrategy, ResultsTranslator resultsTranslator, SQLTranslator sqlTranslator) throws ConnectorException{
-        this(connection, environment, connectionStrategy, null, resultsTranslator, sqlTranslator);
-    }
-    
-    public JDBCSourceConnection(java.sql.Connection connection, ConnectorEnvironment environment, ConnectionStrategy connectionStrategy, ConnectionListener connectionListener, ResultsTranslator resultsTranslator, SQLTranslator sqlTranslator) throws ConnectorException {
-        physicalConnection = connection;
+    public JDBCSourceConnection(java.sql.Connection connection, ConnectorEnvironment environment, Translator sqlTranslator) throws ConnectorException {
+        this.physicalConnection = connection;
         this.environment = environment;
         this.logger = environment.getLogger();
-        this.connectionStrategy = connectionStrategy;
-        this.connectionListener = connectionListener;
-        
-
-        // notify the listner that coneection created
-        if (this.connectionListener != null) { 
-            this.connectionListener.afterConnectionCreation(this.physicalConnection, this.environment);
-        }
+        this.sqlTranslator = sqlTranslator;
+        this.sqlTranslator.afterConnectionCreation(connection);
     }
     
     @Override
     public ResultSetExecution createResultSetExecution(IQueryCommand command,
     		ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new JDBCQueryExecution(command, this.physicalConnection, sqlTranslator, resultsTranslator, logger, this.environment.getProperties(), executionContext, this.environment);
+    	return new JDBCQueryExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext, this.environment);
     }
     
     @Override
     public ProcedureExecution createProcedureExecution(IProcedure command,
     		ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new JDBCProcedureExecution(command, this.physicalConnection, sqlTranslator, resultsTranslator, logger, this.environment.getProperties(), metadata, executionContext, this.environment);
+    	return new JDBCProcedureExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), metadata, executionContext, this.environment);
     }
 
     @Override
     public UpdateExecution createUpdateExecution(ICommand command,
     		ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new JDBCUpdateExecution(command, this.physicalConnection, sqlTranslator, resultsTranslator, logger, this.environment.getProperties(), executionContext);    
+    	return new JDBCUpdateExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext);    
     }
     
     @Override
     public void close() {
-        try {
-            // notify the listener that connection being destroyed
-            if (connectionListener != null) { 
-                connectionListener.beforeConnectionClose(physicalConnection, environment);
-            }
+		closeSourceConnection();
+	}
+
+	protected void closeSourceConnection() {
+		try {
             this.physicalConnection.close();
         } catch(SQLException e) {
         	logger.logDetail("Exception during close: " + e.getMessage());
         }
-    }
+	}
 
     @Override
     public boolean isAlive() {
-        if (connectionStrategy == null) {
-            try {
-                return !this.physicalConnection.isClosed();
-            } catch (SQLException e) {
+    	Connection connection = this.physicalConnection;
+        Statement statement = null;
+    	try {
+    		int timeout = this.sqlTranslator.getIsValidTimeout();
+    		if (timeout >= 0) {
+    			return connection.isValid(timeout);
+    		}
+            if(connection.isClosed()){
                 return false;
+            } 
+            String connectionTestQuery = sqlTranslator.getConnectionTestQuery();
+            if (connectionTestQuery != null) {
+		        statement = connection.createStatement();
+		        statement.executeQuery(connectionTestQuery);
             }
+        } catch(SQLException e) {
+        	return false;
+        } finally {
+            if ( statement != null ) {
+                try {
+                    statement.close();
+                } catch ( SQLException e ) {
+                }
+            }
         }
-        return connectionStrategy.isConnectionAlive(this.physicalConnection);
+        return true;
     }
     
     @Override

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,230 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.internal.ConnectorPropertyNames;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
-
-/**
- * Represents a base class for a JDBC source connection factory.  Subclasses
- * are expected to obtain the properties for their connection in different
- * ways (either from connector properties, from security context, or from
- * some lookup to an external source).  
- */
-public abstract class JDBCSourceConnectionFactory implements ConnectorIdentityFactory {
-    
-    protected static final int NO_ISOLATION_LEVEL_SET = Integer.MIN_VALUE;
-    
-    private ConnectorEnvironment environment;
-    
-    private String deregisterType;
-    
-    private ConnectorIdentityFactory connectorIdentityFactory;
-    private SQLTranslator sqlTranslator;
-    private ResultsTranslator resultsTranslator;
-    
-    /**
-     *
-     */
-    public JDBCSourceConnectionFactory(ConnectorIdentityFactory connectorIdentityFactory) {
-    	this.connectorIdentityFactory = connectorIdentityFactory;
-    }
-
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
-        this.environment = env;
-        Properties props = env.getProperties();
-        this.deregisterType = props.getProperty(ConnectorPropertyNames.DEREGISTER_DRIVER, ConnectorPropertyNames.DEREGISTER_BY_CLASSLOADER);
-        ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
-        Properties connectorProps = environment.getProperties();
-        //create SQLTranslator
-        String className = connectorProps.getProperty(JDBCPropertyNames.EXT_SQL_TRANSLATOR_CLASS);  
-        if(className == null){
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnection.Property_{0}_is_required,_but_not_defined_1", JDBCPropertyNames.EXT_SQL_TRANSLATOR_CLASS)); //$NON-NLS-1$
-        }
-        try {
-			Class sqlTransClass = Thread.currentThread().getContextClassLoader().loadClass(className);
-	        sqlTranslator = (SQLTranslator) sqlTransClass.newInstance();
-	        sqlTranslator.initialize(environment);
-	        
-	        //create ResultsTranslator
-	        className = connectorProps.getProperty(JDBCPropertyNames.EXT_RESULTS_TRANSLATOR_CLASS);  
-	        if(className == null){
-	            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnection.Property_{0}_is_required,_but_not_defined_1", JDBCPropertyNames.EXT_RESULTS_TRANSLATOR_CLASS)); //$NON-NLS-1$
-	        }
-	        Class resultsTransClass = loader.loadClass(className);
-	        resultsTranslator = (ResultsTranslator) resultsTransClass.newInstance();
-	        resultsTranslator.initialize(environment);
-        } catch (ClassNotFoundException e) {
-			throw new ConnectorException(e);
-		} catch (InstantiationException e) {
-			throw new ConnectorException(e);
-		} catch (IllegalAccessException e) {
-			throw new ConnectorException(e);
-		}
-    }
-    
-    protected ConnectorEnvironment getConnectorEnvironment() {
-        return this.environment;
-    }
-    
-    protected Driver createDriver(String driverClassName) throws ConnectorException {
-        // Verify required items
-        if (driverClassName == null || driverClassName.trim().length() == 0) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_driver_class_name_1")); //$NON-NLS-1$
-        }
-        try {
-        	Class clazz = Thread.currentThread().getContextClassLoader().loadClass(driverClassName);
-            return (Driver) clazz.newInstance();
-        } catch(Exception e) {
-            throw new ConnectorException(e, JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", driverClassName)); //$NON-NLS-1$
-        }
-    }
-        
-    protected void validateURL(Driver driver, String url) throws ConnectorException {
-        if (url == null || url.trim().length() == 0) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
-        }
-
-        boolean acceptsURL = false;
-        try {
-            acceptsURL = driver.acceptsURL(url);
-        } catch ( SQLException e ) {
-            throw new ConnectorException(e);
-        }
-        if(!acceptsURL ){
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Driver__7", driver.getClass().getName(), url)); //$NON-NLS-1$
-        }
-    }
-  
-    /**
-     * This creates a JDBC connection.
-     * @throws ConnectorException  if there is an error establishing the connection.
-     */
-    protected com.metamatrix.connector.api.Connection createJDBCConnection(Driver driver, String url, int transactionIsolationLevel, Properties userProps) throws ConnectorException {
-        Connection connection = null;
-
-        // Connect
-        try {
-            connection = driver.connect(url, userProps);
-            if(transactionIsolationLevel != NO_ISOLATION_LEVEL_SET){
-                connection.setTransactionIsolation(transactionIsolationLevel);
-            }
-        } catch ( SQLException e ) {
-            throw new ConnectorException(e);
-        }
-
-        return new JDBCSourceConnection(connection, this.environment, createConnectionStrategy(), getConnectionListener(), resultsTranslator, sqlTranslator);
-    }
-
-    /**
-     * Subclass can override this method to provide an actual ConnectionListener
-     */
-    protected ConnectionListener getConnectionListener() {
-        return null;
-    }
-    
-    /**
-     * Subclass can override this method to provide an actual ConnectionStrategy
-     */
-    protected ConnectionStrategy createConnectionStrategy() {
-        return null;        
-    }
-
-    protected int interpretTransactionIsolationLevel( String levelStr ) throws ConnectorException {
-        int isoLevel = NO_ISOLATION_LEVEL_SET;
-        if(levelStr == null || levelStr.trim().length() == 0){
-            return isoLevel;
-        }
-        
-        levelStr = levelStr.toUpperCase();
-
-        if (levelStr.equals("TRANSACTION_READ_UNCOMMITTED")) { //$NON-NLS-1$
-            isoLevel = Connection.TRANSACTION_READ_UNCOMMITTED;
-        } else if (levelStr.equals("TRANSACTION_READ_COMMITTED")) {//$NON-NLS-1$
-            isoLevel = Connection.TRANSACTION_READ_COMMITTED;
-        } else if (levelStr.equals("TRANSACTION_REPEATABLE_READ")) {//$NON-NLS-1$
-            isoLevel = Connection.TRANSACTION_REPEATABLE_READ;
-        } else if (levelStr.equals("TRANSACTION_SERIALIZABLE")) {//$NON-NLS-1$
-            isoLevel = Connection.TRANSACTION_SERIALIZABLE;
-        } else if (levelStr.equals("TRANSACTION_NONE")) {//$NON-NLS-1$
-            isoLevel = Connection.TRANSACTION_NONE;
-        } else {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.til", levelStr)); //$NON-NLS-1$
-        }
-        return isoLevel;
-    }
-    
-    public void shutdown() {
-        Enumeration drivers = DriverManager.getDrivers();
-        //this is not correct the correct name for datasources, but we will still do the deregister
-        String driverClassname = this.environment.getProperties().getProperty(JDBCPropertyNames.DRIVER_CLASS);
-        // De-Register Driver
-        while(drivers.hasMoreElements()){
-        	Driver tempdriver = (Driver)drivers.nextElement();
-            if(tempdriver.getClass().getClassLoader() != this.getClass().getClassLoader()) {
-            	continue;
-            }
-            if(ConnectorPropertyNames.DEREGISTER_BY_CLASSLOADER.equals(this.deregisterType) 
-            		|| tempdriver.getClass().getName().equals(driverClassname)) {
-                try {
-                    DriverManager.deregisterDriver(tempdriver);
-                } catch (Throwable e) {
-                    this.environment.getLogger().logError(e.getMessage());
-                }
-            }
-        }
-    }
-    
-    public abstract com.metamatrix.connector.api.Connection getConnection(ExecutionContext context) throws ConnectorException;
-    
-    @Override
-    public ConnectorIdentity createIdentity(ExecutionContext context)
-    		throws ConnectorException {
-    	return this.connectorIdentityFactory.createIdentity(context);
-    }
-    
-    public ResultsTranslator getResultsTranslator() {
-		return resultsTranslator;
-	}
-    
-    public SQLTranslator getSqlTranslator() {
-		return sqlTranslator;
-	}
-    
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -34,9 +34,8 @@
 import com.metamatrix.connector.api.DataNotAvailableException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.UpdateExecution;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.IBatchedUpdates;
 import com.metamatrix.connector.language.IBulkInsert;
 import com.metamatrix.connector.language.ICommand;
@@ -52,18 +51,16 @@
     /**
      * @param connection
      * @param sqlTranslator
-     * @param resultsTranslator
-     * @param id
      * @param logger
      * @param props
+     * @param id
      */
     public JDBCUpdateExecution(ICommand command, Connection connection,
-                               SQLTranslator sqlTranslator,
-                               ResultsTranslator resultsTranslator,
+                               Translator sqlTranslator,
                                ConnectorLogger logger,
                                Properties props,
                                ExecutionContext context) {
-        super(connection, sqlTranslator, resultsTranslator, logger, props, context);
+        super(connection, sqlTranslator, logger, props, context);
         this.command = command;
     }
 
@@ -119,7 +116,7 @@
                         }
                         pstmt = getPreparedStatement(command.getSql());
                     }
-                    resultsTranslator.bindPreparedStatementValues(this.connection, pstmt, command);
+                    sqlTranslator.bindPreparedStatementValues(this.connection, pstmt, command);
                     pstmt.addBatch();
                 } else {
                     if (previousCommand != null && previousCommand.isPrepared()) {
@@ -174,7 +171,7 @@
                 connection.setAutoCommit(false);
             }
             PreparedStatement stmt = getPreparedStatement(sql);
-            updateCount = resultsTranslator.executeStatementForBulkInsert(this.connection, stmt, translatedComm);
+            updateCount = sqlTranslator.executeStatementForBulkInsert(this.connection, stmt, translatedComm);
             addStatementWarnings();
             succeeded = true;
         } catch (SQLException e) {
@@ -217,7 +214,7 @@
                 updateCount = getStatement().executeUpdate(sql);
             } else {
             	PreparedStatement pstatement = getPreparedStatement(sql);
-                resultsTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
+                sqlTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
                 updateCount = pstatement.executeUpdate();
             } 
             addStatementWarnings();

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUserIdentityConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUserIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUserIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Driver;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.CredentialMap;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.UserIdentityFactory;
-
-/**
- */
-public class JDBCUserIdentityConnectionFactory extends JDBCSourceConnectionFactory {
-
-    private Driver driver;
-    private String url;
-    private int transIsoLevel;
-    private String system;
-
-    public JDBCUserIdentityConnectionFactory() {
-        super(new UserIdentityFactory());
-    }
-    
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
-        super.initialize(env);
-        system = getConnectorEnvironment().getConnectorName();
-        verifyConnectionProperties(env.getProperties());
-    }
-
-    protected void verifyConnectionProperties(Properties connectionProps) throws ConnectorException{
-        // Find driver 
-        String driverClassName = connectionProps.getProperty(JDBCPropertyNames.DRIVER_CLASS);
-        driver = createDriver(driverClassName);
-        
-        // check URL if there is one
-        url = connectionProps.getProperty(JDBCPropertyNames.URL);
-        if(url != null && url.trim().length() > 0) {
-            validateURL(driver, url);
-        }
-        
-        // Get transaction isolation level
-        transIsoLevel = interpretTransactionIsolationLevel( connectionProps.getProperty(JDBCPropertyNames.TRANSACTION_ISOLATION_LEVEL));        
-    }
-    
-    protected String getUrl() {
-        return this.url;
-    }
-    
-    protected int getTransactionIsolationLevel() {
-        return this.transIsoLevel;
-    }
-
-    public Connection getConnection(ExecutionContext context) throws ConnectorException {
-        String[] userProperties = getUserProperties(context);
-        
-        Properties props = new Properties();
-        props.put("user", userProperties[0]); //$NON-NLS-1$
-        props.put("password", userProperties[1]);       //$NON-NLS-1$
-        return createJDBCConnection(this.driver, getUrl(), getTransactionIsolationLevel(), props);
-    }
-    
-    protected String[] getUserProperties(ExecutionContext context) throws ConnectorException {
-        
-        // By default, assume the session token is a CredentialMap and pull out the user/password props
-        Object trustedPayload = context.getTrustedPayload(); 
-        
-		if(trustedPayload instanceof CredentialMap) {
-			CredentialMap credentials = (CredentialMap)trustedPayload;
-			String user = credentials.getUser(system);
-	        validatePropertyExists(user, CredentialMap.USER_KEYWORD);
-	                
-	        String password = credentials.getPassword(system);
-	        validatePropertyExists(password, CredentialMap.PASSWORD_KEYWORD);        
-	         
-	        return new String[] { user, password };
-        }
-
-        throw new ConnectorException(JDBCPlugin.Util.getString("JDBCUserIdentityConnectionFactory.Unable_to_get_credentials")); //$NON-NLS-1$
-    }   
-
-    /** 
-     * @param property
-     * @throws ConnectorException
-     * @since 4.3
-     */
-    private void validatePropertyExists(String property, String propertyName) throws ConnectorException {
-        if(property == null) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCUserIdentityConnectionFactory.Connection_property_missing", propertyName, system)); //$NON-NLS-1$
-        }
-    }
-   
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -344,13 +344,6 @@
         return null;
     }
 
-    /*
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsXATransactions()
-     */
-    public boolean supportsXATransactions() {
-        return false;
-    }
-
     public boolean supportsInlineViews() {
         return false;
     }       

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/AccessSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/AccessSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/AccessSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -24,10 +24,10 @@
  */
 package com.metamatrix.connector.jdbc.access;
 
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ILimit;
 
-public class AccessSQLTranslator extends SQLTranslator {
+public class AccessSQLTranslator extends Translator {
 	
 	@Override
 	public boolean hasTimeType() {

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2ConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2ConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2ConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -26,9 +26,9 @@
 import java.util.List;
 
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 import com.metamatrix.connector.language.ICompareCriteria.Operator;
 

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2SQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2SQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2SQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -31,8 +31,8 @@
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.SourceSystemFunctions;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IJoin;
 import com.metamatrix.connector.language.ILimit;
@@ -43,7 +43,7 @@
 
 /**
  */
-public class DB2SQLTranslator extends SQLTranslator {
+public class DB2SQLTranslator extends Translator {
 
 	@Override
 	public void initialize(ConnectorEnvironment env) throws ConnectorException {
@@ -80,7 +80,7 @@
 	}
 	
 	@Override
-	public String getConnectionTestQuery() {
+	public String getDefaultConnectionTestQuery() {
 		return "Select 'x' from sysibm.systables where 1 = 2"; //$NON-NLS-1$
 	}
     

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -26,9 +26,9 @@
 import java.util.List;
 
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 import com.metamatrix.connector.language.ICompareCriteria.Operator;
 
@@ -45,7 +45,7 @@
     }
 
     /** 
-     * @see com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
      * @since 5.0
      */
     public List translate(IFunction function) {

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbySQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbySQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,15 +25,15 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
-import com.metamatrix.connector.jdbc.extension.impl.EscapeSyntaxModifier;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.EscapeSyntaxModifier;
+import com.metamatrix.connector.jdbc.translator.Translator;
 
 
 /** 
  * @since 4.3
  */
-public class DerbySQLTranslator extends SQLTranslator {
+public class DerbySQLTranslator extends Translator {
 
 	@Override
 	public void initialize(ConnectorEnvironment env) throws ConnectorException {
@@ -54,7 +54,7 @@
     }
     
     @Override
-    public String getConnectionTestQuery() {
+    public String getDefaultConnectionTestQuery() {
     	return "Select 0 from sys.systables where 1 = 2"; //$NON-NLS-1$
     }
 

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/BindValueVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/BindValueVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/BindValueVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,136 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.extension;
-
-import com.metamatrix.connector.language.ICompareCriteria;
-import com.metamatrix.connector.language.IExistsCriteria;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.IInCriteria;
-import com.metamatrix.connector.language.IInlineView;
-import com.metamatrix.connector.language.IInsert;
-import com.metamatrix.connector.language.ILanguageObject;
-import com.metamatrix.connector.language.ILikeCriteria;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.IScalarSubquery;
-import com.metamatrix.connector.language.ISearchedCaseExpression;
-import com.metamatrix.connector.language.ISetClause;
-import com.metamatrix.connector.language.ISubqueryCompareCriteria;
-import com.metamatrix.connector.visitor.framework.HierarchyVisitor;
-
-/**
- * This visitor will mark literals in well known locations as bindValues.
- * These values will be put in the generated SQL as ? 
- * and have the corresponding value set on the PreparedStatement 
- */
-final class BindValueVisitor extends HierarchyVisitor {
-
-    private boolean replaceWithBinding = false;
-
-    public void visit(IInlineView obj) {
-        replaceWithBinding = false;
-        visitNode(obj.getQuery());
-    }
-
-    public void visit(IScalarSubquery obj) {
-        replaceWithBinding = false;
-        super.visit(obj);
-    }
-
-    public void visit(IExistsCriteria obj) {
-        replaceWithBinding = false;
-        super.visit(obj);
-    }
-
-    public void visit(ISubqueryCompareCriteria obj) {
-        replaceWithBinding = false;
-        super.visit(obj);
-    }
-
-    /**
-     * In general it is not appropriate to use bind values within a function
-     * unless the particulars of the function parameters are know.  
-     * As needed, other visitors or modifiers can set the literals used within
-     * a particular function as bind variables.  
-     */
-    public void visit(IFunction obj) {
-        replaceWithBinding = false;
-        super.visit(obj);
-    }
-
-    public void visit(IInCriteria obj) {
-        replaceWithBinding = true;
-        visitNodes(obj.getRightExpressions());
-    }
-
-    public void visit(ILikeCriteria obj) {
-        replaceWithBinding = true;
-        visitNode(obj.getRightExpression());
-    }
-
-    /**
-     * Note that this will only visit the right expression.  In general most compares
-     * involving literals will be something like element = literal (this is enforced as
-     * much as possible by the QueryRewriter).  In rare circumstances, it is possible to
-     * have literal = literal (most notably null <> null).  Using bind variables on
-     * both sides of the operator is not supported by most databases.
-     */
-    public void visit(ICompareCriteria obj) {
-        replaceWithBinding = true;
-        visitNode(obj.getRightExpression());
-    }
-
-    /**
-     * Will look for bind values in the when criteria.
-     * The actual restriction for case statements seems to be that at least one branch must
-     * not contain a bind variable.
-     */
-    public void visit(ISearchedCaseExpression obj) {
-        for (int i = 0; i < obj.getWhenCount(); i++) {
-            visitNode(obj.getWhenCriteria(i));
-        }
-    }
-
-    @Override
-    public void visit(IInsert obj) {
-        replaceWithBinding = true;
-        visitNodes(obj.getValues());
-    }
-    
-    @Override
-    public void visit(ISetClause obj) {
-        replaceWithBinding = true;
-        visitNode(obj.getValue());
-    }
-
-    public void visit(ILiteral obj) {
-        if (replaceWithBinding || TranslatedCommand.isBindEligible(obj)) {
-            obj.setBindValue(true);
-        }
-    }
-    
-    public void visitNode(ILanguageObject obj) {
-        boolean replacementMode = replaceWithBinding;
-        super.visitNode(obj);
-        this.replaceWithBinding = replacementMode;
-    }
-}
\ No newline at end of file

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/FunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/FunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/FunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.extension;
-
-import java.util.List;
-
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-
-/**
- * Implementations of this interface are used to modify metamatrix functions
- * coming in to the connector into alternate datasource-specific language, if
- * necessary. 
- */
-public interface FunctionModifier {
-    
-    /**
-     * Takes an IFunction and returns the datasource-specific IExpression,
-     * or can possibly return the unmodified function parameter itself. 
-     * @param function
-     * @return IExpression or unmodified function
-     * @since 4.2
-     */
-    IExpression modify(IFunction function);
-    
-    /**
-     * Return a List of translated parts (LanguageObjects and Strings), or null
-     * if this FunctionModifier wishes to rely on the default translation of the
-     * conversion visitor. 
-     * @param function IFunction to be translated
-     * @return List of translated parts, or null
-     * @since 4.2
-     */
-    List translate(IFunction function);
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ResultsTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ResultsTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ResultsTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.extension;
-
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.TimeZone;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.language.ICommand;
-
-/**
- * Specify database-specific behavior for translating results.
- */
-public interface ResultsTranslator {
-    
-    /**
-     * Initialize the results translator with the connector's environment, which
-     * can be used to retrieve configuration parameters
-     * @param env The connector environment
-     * @throws ConnectorException If an error occurs during initialization
-     */
-    void initialize(ConnectorEnvironment env) throws ConnectorException; 
-
-    /**
-     * Get a list of ValueTranslator objects that specify database-specific value
-     * translation logic.  By default, the JDBC connector has a large set of available
-     * translator.
-     * @return List of ValueTranslator
-     */
-    List getValueTranslators();
-
-    /**
-     * Used to specify a special database-specific value retriever.  By default, the BasicValueRetriever
-     * will be used to retrieve objects from the ResultSet via the getObject() method. 
-     * @return The specialized ValueRetriever
-     */
-    ValueRetriever getValueRetriever();     
-    
-    /**
-     * Execute a stored procedure - this is often database-dependent.
-     * @param stmt The CallableStatement created by the connector
-     * @param command The translated command information
-     * @return The ResultSet returned by the stored procedure
-     * @throws SQLException If an error occurs during execution
-     */
-    ResultSet executeStoredProcedure(CallableStatement stmt, TranslatedCommand command) throws SQLException ;
-    
-    /**
-     * Populate the prepared statement.
-     * The prepared statement values will be set.
-     * @param conn
-     * @param stmt
-     * @param command
-     * @throws SQLException
-     */
-    public void bindPreparedStatementValues(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException;
-        
-    /**
-     * Execute the bulk insert statement. 
-     * @param conn The connection
-     * @param stmt The prepared statement with the query
-     * @param command The translated command, which contains the large objects to prepare with
-     * @return Update count for the execution
-     * @throws SQLException If an error occurs during execution
-     */
-    public int executeStatementForBulkInsert(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException;    
-        
-    /**
-     * Determine the time zone the database is located in.  Typically, this time zone is 
-     * the same as the local time zone, in which case, null should be returned.
-     * @return Database time zone
-     */
-    TimeZone getDatabaseTimezone();
-    
-    /**
-     * Allow an extension to modify any batch before it is returned to MetaMatrix.  This
-     * method can be used to apply row-level entitlements, modify data values for particular
-     * users, etc. 
-     * @param batch The batch to return
-     * @param context The execution context for the query 
-     * @param command The modified command that was obtained from the translation visitor provided by the SQLTranslator
-     * @return The batch to use instead
-     * @since 4.2
-     */
-    List modifyRow(List batch, ExecutionContext context, ICommand command);    
-    
-    /**
-     * Get the max result rows allowed
-     * 
-     * @return the max result rows
-     */
-    int getMaxResultRows();
-    
-    
-    TypeFacility getTypeFacility();
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLConversionVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLConversionVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLConversionVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,347 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.extension;
-
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.language.IBulkInsert;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IElement;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageObject;
-import com.metamatrix.connector.language.ILimit;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.IParameter;
-import com.metamatrix.connector.language.IProcedure;
-import com.metamatrix.connector.language.IQuery;
-import com.metamatrix.connector.language.IQueryCommand;
-import com.metamatrix.connector.language.ISetQuery;
-import com.metamatrix.connector.language.IParameter.Direction;
-import com.metamatrix.connector.language.ISetQuery.Operation;
-import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.visitor.util.SQLStringVisitor;
-
-/**
- * This visitor takes an ICommand and does DBMS-specific conversion on it
- * to produce a SQL String.  This class is expected to be subclassed.
- * Specialized instances of this class can be gotten from a SQL Translator
- * {@link SQLTranslator#getTranslationVisitor(RuntimeMetadata) using this method}.
- */
-public class SQLConversionVisitor extends SQLStringVisitor{
-
-    private static DecimalFormat DECIMAL_FORMAT = 
-        new DecimalFormat("#############################0.0#############################"); //$NON-NLS-1$    
-    private static double SCIENTIC_LOW = Math.pow(10, -3);
-    private static double SCIENTIC_HIGH = Math.pow(10, 7);
-    
-    private Map<String, FunctionModifier> modifiers;
-    private ExecutionContext context;
-    private SQLTranslator translator;
-    private Calendar cal;
-
-    private boolean prepared;
-    
-    private List preparedValues = new ArrayList();
-    private List preparedTypes = new ArrayList();
-    
-    public SQLConversionVisitor(SQLTranslator translator) {
-        this.translator = translator;
-        this.prepared = translator.usePreparedStatements();
-        this.modifiers = translator.getFunctionModifiers();
-        TimeZone tz = translator.getDatabaseTimeZone();
-        if (tz != null) {
-        	this.cal = Calendar.getInstance(tz);
-        }
-    }
-
-    public void visit(IBulkInsert obj) {
-        this.prepared = true;
-
-        super.visit(obj);
-        
-        for (int i = 0; i < obj.getElements().size(); i++) {
-            IElement element = (IElement) obj.getElements().get(i);
-            this.preparedTypes.add(element.getType());
-        }
-
-        this.preparedValues = obj.getRows();
-    } 
-    
-    /**
-     * @param type
-     * @param object
-     * @param valuesbuffer
-     */
-    private void translateSQLType(Class type, Object obj, StringBuffer valuesbuffer) {
-        if (obj == null) {
-            valuesbuffer.append(NULL);
-        } else {
-            if(Number.class.isAssignableFrom(type)) {
-                boolean useFormatting = false;
-                
-                if (Double.class.isAssignableFrom(type)){
-                    double value = ((Double)obj).doubleValue();
-                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH); 
-                }
-                else if (Float.class.isAssignableFrom(type)){
-                    float value = ((Float)obj).floatValue();
-                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH);
-                }
-                // The formatting is to avoid the so-called "scientic-notation"
-                // where toString will use for numbers greater than 10p7 and
-                // less than 10p-3, where database may not understand.
-                if (useFormatting) {
-                	synchronized (DECIMAL_FORMAT) {
-                        valuesbuffer.append(DECIMAL_FORMAT.format(obj));
-					}
-                }
-                else {
-                    valuesbuffer.append(obj);
-                }
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
-                valuesbuffer.append(translator.translateLiteralBoolean((Boolean)obj));
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
-                valuesbuffer.append(translator.translateLiteralTimestamp((Timestamp)obj, cal));
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
-                valuesbuffer.append(translator.translateLiteralTime((Time)obj, cal));
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
-                valuesbuffer.append(translator.translateLiteralDate((java.sql.Date)obj, cal));
-            } else {
-                // If obj is string, toSting() will not create a new String 
-                // object, it returns it self, so new object creation. 
-                valuesbuffer.append("'") //$NON-NLS-1$
-                      .append(escapeString(obj.toString()))
-                      .append("'"); //$NON-NLS-1$
-            }
-        }        
-    }
-
-    /**
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IProcedure)
-     */
-    public void visit(IProcedure obj) {
-        this.prepared = true;
-        /*
-         * preparedValues is now a list of procedure params instead of just values
-         */
-        this.preparedValues = obj.getParameters();
-        super.buffer.append(generateSqlForStoredProcedure(obj));
-    }
-
-    /**
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IFunction)
-     */
-    public void visit(IFunction obj) {
-        if(this.modifiers != null) {
-            FunctionModifier functionModifier = (FunctionModifier)this.modifiers.get(obj.getName().toLowerCase());
-            if(functionModifier != null) {
-                List parts = functionModifier.translate(obj);
-                
-                // null means the FunctionModifier will rely on default translation
-                if (parts != null) {
-                    Iterator iter = parts.iterator();
-                    while(iter.hasNext()) {
-                        Object part = iter.next();
-                        if(part instanceof String) {
-                            buffer.append(part);
-                        } else {
-                            append((ILanguageObject)part);
-                        }
-                    }
-                    return;
-                } 
-            } 
-        } 
-        super.visit(obj);
-    }
-
-    /**
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.ILiteral)
-     */
-    public void visit(ILiteral obj) {
-        if (this.prepared && obj.isBindValue()) {
-            buffer.append(UNDEFINED_PARAM);
-            preparedValues.add(obj.getValue());
-            preparedTypes.add(obj.getType());
-        } else {
-            translateSQLType(obj.getType(), obj.getValue(), buffer);
-        }
-    }
-
-    /**
-     * Set the per-command execution context on this visitor. 
-     * @param context ExecutionContext
-     * @since 4.3
-     */
-    public void setExecutionContext(ExecutionContext context) {
-        this.context = context;
-    }
-    
-    /**
-     * Retrieve the per-command execution context for this visitor 
-     * (intended for subclasses to use).
-     * @return
-     * @since 4.3
-     */
-    protected ExecutionContext getExecutionContext() {
-        return this.context;
-    }
-
-    protected String getSourceComment(ICommand command) {
-    	return this.translator.getSourceComment(this.context, command);
-    }
-    
-    /**
-     * This is a generic implementation. Subclass should override this method
-     * if necessary.
-     * @param exec The command for the stored procedure.
-     * @return String to be executed by CallableStatement.
-     */
-    protected String generateSqlForStoredProcedure(IProcedure exec) {
-        StringBuffer prepareCallBuffer = new StringBuffer();
-        prepareCallBuffer.append("{ "); //$NON-NLS-1$
-
-        List params = exec.getParameters();
-
-        //check whether a "?" is needed if there are returns
-        boolean needQuestionMark = false;
-        Iterator iter = params.iterator();
-        while(iter.hasNext()){
-            IParameter param = (IParameter)iter.next();
-            if(param.getDirection() == Direction.RETURN){
-                needQuestionMark = true;
-                break;
-            }
-        }
-        
-        prepareCallBuffer.append(getSourceComment(exec));
-        
-        if(needQuestionMark){
-            prepareCallBuffer.append("?="); //$NON-NLS-1$
-        }
-
-        prepareCallBuffer.append(" call ");//$NON-NLS-1$
-        prepareCallBuffer.append(exec.getMetadataID() != null ? getName(exec.getMetadataID()) : exec.getProcedureName());
-        prepareCallBuffer.append("("); //$NON-NLS-1$
-
-        int numberOfParameters = 0;
-        iter = params.iterator();
-        while(iter.hasNext()){
-            IParameter param = (IParameter)iter.next();
-            if(param.getDirection() == Direction.IN || param.getDirection() == Direction.OUT || param.getDirection() == Direction.INOUT){
-                if(numberOfParameters > 0){
-                    prepareCallBuffer.append(","); //$NON-NLS-1$
-                }
-                prepareCallBuffer.append("?"); //$NON-NLS-1$
-                numberOfParameters++;
-            }
-        }
-        prepareCallBuffer.append(")"); //$NON-NLS-1$
-        prepareCallBuffer.append("}"); //$NON-NLS-1$
-        return prepareCallBuffer.toString();
-    }
-    
-    /** 
-     * @return the preparedValues
-     */
-    List getPreparedValues() {
-        return this.preparedValues;
-    }
-    
-    /** 
-     * @return the preparedValues
-     */
-    List getPreparedTypes() {
-        return this.preparedTypes;
-    }
-    
-    public boolean isPrepared() {
-		return prepared;
-	}
-    
-    public void setPrepared(boolean prepared) {
-		this.prepared = prepared;
-	}
-    
-    @Override
-    protected boolean useAsInGroupAlias() {
-    	return this.translator.useAsInGroupAlias();
-    }
-    
-    @Override
-    public void visit(IQuery obj) {
-    	if (obj.getLimit() != null) {
-    		handleLimit(obj);
-    	} else {
-    		super.visit(obj);
-    	}
-    }
-    
-    @Override
-    public void visit(ISetQuery obj) {
-    	if (obj.getLimit() != null) {
-    		handleLimit(obj);
-    	} else {
-    		super.visit(obj);
-    	}
-    }
-    
-    @Override
-    protected boolean useParensForSetQueries() {
-    	return translator.useParensForSetQueries();
-    }
-    
-	private void handleLimit(IQueryCommand obj) {
-		ILimit limit = obj.getLimit();
-    	obj.setLimit(null);
-    	StringBuffer current = this.buffer;
-    	this.buffer = new StringBuffer();
-    	append(obj);
-    	current.append(this.translator.addLimitString(this.buffer.toString(), limit));
-    	this.buffer = current;
-    	obj.setLimit(limit);
-	}
-	
-	@Override
-	protected String replaceElementName(String group, String element) {
-		return translator.replaceElementName(group, element);
-	}
-	
-	@Override
-	protected void appendSetOperation(Operation operation) {
-		buffer.append(translator.getSetOperationString(operation));
-	}
-                
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,248 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.extension;
-
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.text.MessageFormat;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TimeZone;
-
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILimit;
-import com.metamatrix.connector.language.ISetQuery;
-
-/**
- * Base class for creating source SQL queries and retrieving results.
- * Specific databases should override as necessary.
- */
-public class SQLTranslator {
-
-    private static final MessageFormat COMMENT = new MessageFormat("/*teiid sessionid:{0}, requestid:{1}.{2}*/ "); //$NON-NLS-1$
-
-    public final static TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
-
-	private Map<String, FunctionModifier> functionModifiers = new HashMap<String, FunctionModifier>();
-    private TimeZone databaseTimeZone;
-    private ConnectorEnvironment environment;
-    
-    private boolean useComments;
-    private boolean usePreparedStatements;
-    
-    /**
-     * Initialize the SQLTranslator.
-     * @param env
-     * @param metadata
-     * @throws ConnectorException
-     */
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
-        this.environment = env;
-
-        String timeZone = env.getProperties().getProperty(JDBCPropertyNames.DATABASE_TIME_ZONE);
-        if(timeZone != null && timeZone.trim().length() > 0) {
-        	TimeZone tz = TimeZone.getTimeZone(timeZone);
-            // Check that the dbms time zone is really different than the local time zone
-            if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) {
-                this.databaseTimeZone = tz;                
-            }               
-        }   
-        
-        this.useComments = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, false);
-        this.usePreparedStatements = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_BIND_VARIABLES, false);
-    }
-    
-    public TimeZone getDatabaseTimeZone() {
-		return databaseTimeZone;
-	}
-    
-    public ConnectorEnvironment getEnvironment() {
-		return environment;
-	}
-    
-    public ILanguageFactory getLanguageFactory() {
-    	return environment.getLanguageFactory();
-    }
-    
-    /**
-     * Modify the command.
-     * @param command
-     * @param context
-     * @return
-     */
-    public ICommand modifyCommand(ICommand command, ExecutionContext context) throws ConnectorException {
-    	return command;
-    }
-    
-    /**
-     * Return a map of function name in lower case to FunctionModifier.
-     * @return Map of function name to FunctionModifier.
-     */
-    public Map<String, FunctionModifier> getFunctionModifiers() {
-    	return functionModifiers;
-    }
-    
-    public void registerFunctionModifier(String name, FunctionModifier modifier) {
-    	this.functionModifiers.put(name, modifier);
-    }
-    
-    /**
-     * Subclasses should override this method to provide a different sql translation
-     * of the literal boolean value.  By default, a boolean literal is represented as:
-     * <code>'0'</code> or <code>'1'</code>.
-     * @param booleanValue Boolean value, never null
-     * @return Translated string
-     */
-    public String translateLiteralBoolean(Boolean booleanValue) {
-        if(booleanValue.booleanValue()) {
-            return "1"; //$NON-NLS-1$
-        }
-        return "0"; //$NON-NLS-1$
-    }
-
-    /**
-     * Subclasses should override this method to provide a different sql translation
-     * of the literal date value.  By default, a date literal is represented as:
-     * <code>{d'2002-12-31'}</code>
-     * @param dateValue Date value, never null
-     * @return Translated string
-     */
-    public String translateLiteralDate(java.sql.Date dateValue, Calendar cal) {
-        return "{d'" + formatDateValue(dateValue, cal) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Subclasses should override this method to provide a different sql translation
-     * of the literal time value.  By default, a time literal is represented as:
-     * <code>{t'23:59:59'}</code>
-     * @param timeValue Time value, never null
-     * @return Translated string
-     */
-    public String translateLiteralTime(Time timeValue, Calendar cal) {
-    	if (!hasTimeType()) {
-    		return "{ts'1970-01-01 " + formatDateValue(timeValue, cal) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
-    	}
-        return "{t'" + formatDateValue(timeValue, cal) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /**
-     * Subclasses should override this method to provide a different sql translation
-     * of the literal timestamp value.  By default, a timestamp literal is
-     * represented as: <code>{ts'2002-12-31 23:59:59'}</code>.
-     * @param timestampValue Timestamp value, never null
-     * @return Translated string
-     */
-    public String translateLiteralTimestamp(Timestamp timestampValue, Calendar cal) {
-        return "{ts'" + formatDateValue(timestampValue, cal) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    /**
-     * Format the dateObject (of type date, time, or timestamp) into a string
-     * using the DatabaseTimeZone format.
-     * @param dateObject
-     * @param cal
-     * @return Formatted string
-     */
-    public String formatDateValue(java.util.Date dateObject, Calendar cal) {
-        if (dateObject instanceof Timestamp && getTimestampNanoSecondPrecision() < 9) {
-        	Timestamp ts = (Timestamp)dateObject;
-        	Timestamp newTs = new Timestamp(ts.getTime());
-        	if (getTimestampNanoSecondPrecision() > 0) {
-	        	int mask = 10^(9-getTimestampNanoSecondPrecision());
-	        	newTs.setNanos(ts.getNanos()/mask*mask);
-        	}
-        	dateObject = newTs;
-        }
-    	
-    	if(cal == null) {
-            return dateObject.toString();
-        }
-        
-        return getEnvironment().getTypeFacility().convertDate(dateObject,
-				DEFAULT_TIME_ZONE, cal, dateObject.getClass()).toString();        
-    }    
-    
-    public boolean addSourceComment() {
-        return useComments;
-    }   
-    
-    public String addLimitString(String queryCommand, ILimit limit) {
-    	return queryCommand + " " + limit.toString(); //$NON-NLS-1$
-    }
-    
-    /**
-     * Indicates whether group alias should be of the form
-     * "...FROM groupA AS X" or "...FROM groupA X".  Certain
-     * data sources (such as Oracle) may not support the first
-     * form. 
-     * @return boolean
-     */
-    public boolean useAsInGroupAlias(){
-        return true;
-    }
-    
-    public boolean usePreparedStatements() {
-    	return this.usePreparedStatements;
-    }
-    
-    public boolean useParensForSetQueries() {
-    	return false;
-    }
-    
-    public boolean hasTimeType() {
-    	return true;
-    }
-    
-    public String getSetOperationString(ISetQuery.Operation operation) {
-    	return operation.toString();
-    }
-    
-    public String getSourceComment(ExecutionContext context, ICommand command) {
-	    if (addSourceComment() && context != null) {
-	    	synchronized (COMMENT) {
-	            return COMMENT.format(new Object[] {context.getConnectionIdentifier(), context.getRequestIdentifier(), context.getPartIdentifier()});
-			}
-	    }
-	    return ""; //$NON-NLS-1$ 
-    }
-    
-    public String replaceElementName(String group, String element) {
-    	return null;
-    }
-    
-    public int getTimestampNanoSecondPrecision() {
-    	return 9;
-    }
-    
-    public String getConnectionTestQuery() {
-    	return "select 1"; //$NON-NLS-1$
-    }
-    
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/TranslatedCommand.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/TranslatedCommand.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/TranslatedCommand.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.extension;
-
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.visitor.util.CollectorVisitor;
-
-/**
- * This is a utility class used to translate an ICommand using a SQLConversionVisitor.
- * The SQLConversionVisitor should not be invoked directly; this object will use it to
- * translate the ICommand.
- */
-public class TranslatedCommand {
-
-    private String sql;
-    private boolean prepared;
-    private List preparedValues;
-    private List preparedTypes;
-    
-    private SQLConversionVisitor sqlConversionVisitor;
-    private FunctionReplacementVisitor functionVisitor;
-    private ExecutionContext context;
-    private SQLTranslator sqlTranslator;
-    
-    /**
-     * Constructor, takes a SQLConversionVisitor subclass 
-     * @param visitor a SQLConversionVisitor subclass 
-     */
-    public TranslatedCommand(ExecutionContext context, SQLTranslator sqlTranslator){
-    	this.context = context;
-    	this.sqlTranslator = sqlTranslator;
-    	
-    	Map<String, FunctionModifier> modifiers = sqlTranslator.getFunctionModifiers();
-        this.sqlConversionVisitor = new SQLConversionVisitor(sqlTranslator);
-        sqlConversionVisitor.setExecutionContext(context);
-        this.functionVisitor = new FunctionReplacementVisitor(modifiers);
-    }
-    
-    public TranslatedCommand(ExecutionContext context, SQLTranslator sqlTranslator, SQLConversionVisitor sqlConversionVisitor, FunctionReplacementVisitor functionVisitor) {
-    	this.context = context;
-    	this.sqlTranslator = sqlTranslator;
-    	this.sqlConversionVisitor = sqlConversionVisitor;
-    	this.functionVisitor = functionVisitor;
-    }
-    
-    /**
-     * The method to cause this object to do it's thing.  This method should
-     * be called right after the constructor; afterward, all of the getter methods
-     * can be called to retrieve results. 
-     * @param command ICommand to be translated
-     * @throws ConnectorException 
-     */
-    public void translateCommand(ICommand command) throws ConnectorException {
-        this.sql = getSQL(command);
-        this.preparedValues = this.sqlConversionVisitor.getPreparedValues();
-        this.preparedTypes = this.sqlConversionVisitor.getPreparedTypes();
-        this.prepared = this.sqlConversionVisitor.isPrepared();
-    }
-	
-	private String getSQL(ICommand command) throws ConnectorException {
-        command = sqlTranslator.modifyCommand(command, context);
-		command.acceptVisitor(functionVisitor);
-        
-        if (sqlTranslator.usePreparedStatements() || hasBindValue(command)) {
-            this.sqlConversionVisitor.setPrepared(true);
-            
-            command.acceptVisitor(new BindValueVisitor());
-        }
-        
-		this.sqlConversionVisitor.append(command);
-		return this.sqlConversionVisitor.toString();
-	}
-
-    /**
-     * Simple check to see if any values in the command should be replaced with bind values
-     *  
-     * @param command
-     * @return
-     */
-    private boolean hasBindValue(ICommand command) {
-        for (ILiteral l : CollectorVisitor.collectObjects(ILiteral.class, command)) {
-            if (l.isBindValue() || isBindEligible(l)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /** 
-     * @param l
-     * @return
-     */
-    static boolean isBindEligible(ILiteral l) {
-        if (TypeFacility.RUNTIME_TYPES.CLOB.equals(l.getType())
-                        || TypeFacility.RUNTIME_TYPES.BLOB.equals(l.getType()) 
-                        || TypeFacility.RUNTIME_TYPES.OBJECT.equals(l.getType())) {
-            return true;
-        }
-        return false;
-    }
-    
-    /**
-     * Return List of values to set on a prepared statement, if 
-     * necessary (see {@link #getStatementType})
-     * @return List of values to be set on a prepared statement
-     */
-    public List getPreparedValues() {
-        return preparedValues;
-    }
-    
-    /**
-     * Return List of types to set on a prepared statement, if 
-     * necessary (see {@link #getStatementType})
-     * @return List of types to be set on a prepared statement
-     */
-    public List getPreparedTypes() {
-        return preparedTypes;
-    }
-
-    /**
-     * Get String SQL of translated command; but use 
-     * {@link #nextLargeSetQuerySQL} if this command is 
-     * a {@link #isLargeSetQuery large set query}
-     * @return SQL of translated command, or null if the
-     * command is a {@link #isLargeSetQuery large set query}
-     */
-    public String getSql() {
-        return sql;
-    }
-
-    /**
-     * Return the statement type, one of {@link #STMT_TYPE_STATEMENT},
-     * {@link #STMT_TYPE_PREPARED_STATEMENT}, or
-     * {@link #STMT_TYPE_CALLABLE_STATEMENT}
-     * @return statement type of translated command
-     */
-    public boolean isPrepared() {
-        return prepared;
-    }
-
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ValueRetriever.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ValueRetriever.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/ValueRetriever.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.extension;
-
-import java.sql.CallableStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Calendar;
-
-import com.metamatrix.connector.api.TypeFacility;
-
-/**
- * Specifies how value objects are retrieved from JDBC ResultSet for different 
- * expected output types.  This allows database-specific connectors to use 
- * specialized methods like getClob() rather than generic getObject() methods.  
- */
-public interface ValueRetriever {
-    
-    /**
-     * Retrieve the value at <code>columnIndex</code> from the specified <code>results</code>.
-     * 
-     * @param results The results to retrieve the value from 
-     * @param columnIndex The index to use when retrieving the value
-     * @param expectedType The MetaMatrix runtime type class that is expected to be returned, as 
-     * specified by the select statement of the query
-     * @param cal The Calendar to be used for Date, Time, and Timestamp values
-     * @return The object that was retrieved
-     * @throws SQLException If an error occurred retrieving the value
-     */
-    Object retrieveValue(ResultSet results, int columnIndex, Class expectedType, Calendar cal, TypeFacility typeFacility) throws SQLException;
-        
-    /**
-     * Retrieve the value at <code>parameterIndex</code> from the callable statement
-     * @param results
-     * @param parameterIndex
-     * @param expectedType
-     * @param cal
-     * @return
-     * @throws SQLException
-     */
-    Object retrieveValue(CallableStatement results, int parameterIndex, Class expectedType, Calendar cal, TypeFacility typeFacility) throws SQLException;    
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/InformixSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/InformixSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/InformixSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,12 +27,12 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.Translator;
 
 /**
  */
-public class InformixSQLTranslator extends SQLTranslator {
+public class InformixSQLTranslator extends Translator {
 
 	@Override
 	public void initialize(ConnectorEnvironment env) throws ConnectorException {
@@ -41,7 +41,7 @@
     }
 	
 	@Override
-	public String getConnectionTestQuery() {
+	public String getDefaultConnectionTestQuery() {
 		return "select 'x' from informix.sysusers where 1=0"; //$NON-NLS-1$
 	}
     

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm/MMSingleIdentityConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm/MMSingleIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm/MMSingleIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.mm;
-
-import com.metamatrix.connector.jdbc.*;
-import com.metamatrix.connector.jdbc.ConnectionStrategy;
-import com.metamatrix.connector.jdbc.JDBCSingleIdentityConnectionFactory;
-
-/** 
- * @since 4.3
- */
-public class MMSingleIdentityConnectionFactory extends JDBCSingleIdentityConnectionFactory{
-    private String queryTest = "Select 1"; //$NON-NLS-1$
-    
-    /** 
-     * @see com.metamatrix.connector.jdbc.JDBCSourceConnectionFactory#createConnectionStrategy()
-     * @since 4.3
-     */
-    protected ConnectionStrategy createConnectionStrategy() {
-        return new ConnectionQueryStrategy(queryTest);        
-    }
-    
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,8 +25,8 @@
 import java.util.Arrays;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,18 +25,17 @@
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.util.Calendar;
 
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
+import com.metamatrix.connector.jdbc.translator.Translator;
 
 
 /** 
  * @since 4.3
  */
-public class MySQLTranslator extends SQLTranslator {
+public class MySQLTranslator extends Translator {
 
 	@Override
     public void initialize(ConnectorEnvironment env) throws ConnectorException {
@@ -45,18 +44,18 @@
     }  
 	
 	@Override
-    public String translateLiteralDate(Date dateValue, Calendar cal) {
-        return "DATE('" + formatDateValue(dateValue, cal) + "')";  //$NON-NLS-1$//$NON-NLS-2$
+    public String translateLiteralDate(Date dateValue) {
+        return "DATE('" + formatDateValue(dateValue) + "')";  //$NON-NLS-1$//$NON-NLS-2$
     }
 
 	@Override
-    public String translateLiteralTime(Time timeValue, Calendar cal) {
-        return "TIME('" + formatDateValue(timeValue, cal) + "')";  //$NON-NLS-1$//$NON-NLS-2$
+    public String translateLiteralTime(Time timeValue) {
+        return "TIME('" + formatDateValue(timeValue) + "')";  //$NON-NLS-1$//$NON-NLS-2$
     }
 
 	@Override
-    public String translateLiteralTimestamp(Timestamp timestampValue, Calendar cal) {
-        return "TIMESTAMP('" + formatDateValue(timestampValue, cal) + "')";  //$NON-NLS-1$//$NON-NLS-2$
+    public String translateLiteralTimestamp(Timestamp timestampValue) {
+        return "TIMESTAMP('" + formatDateValue(timestampValue) + "')";  //$NON-NLS-1$//$NON-NLS-2$
     }
 	
 	@Override

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ConcatFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ConcatFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ConcatFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,7 +27,7 @@
 import java.util.List;
 
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
 import com.metamatrix.connector.language.ICriteria;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
@@ -54,7 +54,7 @@
     }
 
     /** 
-     * @see com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier#modify(com.metamatrix.connector.language.IFunction)
+     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#modify(com.metamatrix.connector.language.IFunction)
      */
     public IExpression modify(IFunction function) {
         List when = new ArrayList();
@@ -111,7 +111,7 @@
     }
         
     /** 
-     * @see com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
      */
     public List translate(IFunction function) {
         return null; //allow default translation

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,8 +22,8 @@
 
 package com.metamatrix.connector.jdbc.oracle;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ExtractFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ExtractFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ExtractFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,8 +25,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LeftOrRightFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LeftOrRightFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LeftOrRightFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -23,8 +23,8 @@
 package com.metamatrix.connector.jdbc.oracle;
 
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LocateFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LocateFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LocateFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,8 +22,8 @@
 
 package com.metamatrix.connector.jdbc.oracle;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/Log10FunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/Log10FunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/Log10FunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,8 +22,8 @@
 
 package com.metamatrix.connector.jdbc.oracle;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 
 public class Log10FunctionModifier extends BasicFunctionModifier implements FunctionModifier {

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,8 +22,8 @@
 
 package com.metamatrix.connector.jdbc.oracle;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,9 +25,9 @@
 import java.util.List;
 
 import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;
@@ -46,7 +46,7 @@
     /**
      * Intentionally return null, rely on the SQLStringVisitor being used by caller
      * (Oracle or Oracle8 SQLConversionVisitor (SQLConversionVisitor))
-     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
      */
     public List translate(IFunction function) {
         return null;

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleResultsTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleResultsTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleResultsTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.oracle;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Calendar;
-
-import com.metamatrix.connector.jdbc.extension.impl.BasicResultsTranslator;
-
-public class OracleResultsTranslator extends BasicResultsTranslator {
-    protected void bindValue(PreparedStatement stmt, Object param, Class paramType, int i, Calendar cal) throws SQLException {
-    	if(param == null && Object.class.equals(paramType)){
-    		//Oracle drive does not support JAVA_OBJECT type
-    		stmt.setNull(i, Types.LONGVARBINARY);
-    		return;
-    	}
-    	super.bindValue(stmt, param, paramType, i, cal);
-    }
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -24,14 +24,21 @@
  */
 package com.metamatrix.connector.jdbc.oracle;
 
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
 import java.util.List;
 
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
+import com.metamatrix.connector.jdbc.JDBCPlugin;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IElement;
 import com.metamatrix.connector.language.IGroup;
@@ -44,7 +51,7 @@
 
 /**
  */
-public class OracleSQLTranslator extends SQLTranslator {
+public class OracleSQLTranslator extends Translator {
 
     public final static String HINT_PREFIX = "/*+"; //$NON-NLS-1$
     public final static String DUAL = "DUAL"; //$NON-NLS-1$
@@ -223,8 +230,52 @@
     }
     
     @Override
-    public String getConnectionTestQuery() {
+    public String getDefaultConnectionTestQuery() {
     	return "Select 'x' from DUAL"; //$NON-NLS-1$
     }
     
+    @Override
+    public void bindValue(PreparedStatement stmt, Object param, Class paramType, int i) throws SQLException {
+    	if(param == null && Object.class.equals(paramType)){
+    		//Oracle drive does not support JAVA_OBJECT type
+    		stmt.setNull(i, Types.LONGVARBINARY);
+    		return;
+    	}
+    	super.bindValue(stmt, param, paramType, i);
+    }
+    
+    @Override
+    public void afterInitialConnectionCreation(Connection connection) {
+    	String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_oracle_connection_details"); //$NON-NLS-1$
+    	ResultSet rs = null;
+        Statement stmt = null;
+        try {                
+            stmt = connection.createStatement();
+            rs = stmt.executeQuery("select * from v$instance"); 
+            
+            int columnCount = rs.getMetaData().getColumnCount();
+            while (rs.next()) {
+                StringBuffer sb = new StringBuffer();
+                for (int i = 1; i <= columnCount; i++) {
+                    sb.append(rs.getMetaData().getColumnName(i)).append("=").append(rs.getString(i)).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
+                }                    
+                // log the queried information
+                getEnvironment().getLogger().logInfo(sb.toString());                    
+            }                
+            
+        } catch (SQLException e) {
+            getEnvironment().getLogger().logInfo(errorStr); 
+        }finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                } 
+                if (stmt != null) {
+                    stmt.close();
+                }
+            } catch (SQLException e1) {
+                getEnvironment().getLogger().logInfo(errorStr);
+            }
+        }
+    }
 }

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSingleIdentityConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSingleIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSingleIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.oracle;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.jdbc.ConnectionListener;
-import com.metamatrix.connector.jdbc.ConnectionQueryStrategy;
-import com.metamatrix.connector.jdbc.ConnectionStrategy;
-import com.metamatrix.connector.jdbc.DefaultConnectionListener;
-import com.metamatrix.connector.jdbc.JDBCPlugin;
-import com.metamatrix.connector.jdbc.JDBCSingleIdentityConnectionFactory;
-
-public class OracleSingleIdentityConnectionFactory extends JDBCSingleIdentityConnectionFactory{
-    private String queryTest = "Select 'x' from DUAL"; //$NON-NLS-1$
-    private ConnectionListener connectionListener = new OracleConnectionListener();
-    
-    protected ConnectionStrategy createConnectionStrategy() {
-        return new ConnectionQueryStrategy(queryTest);        
-    }
-  
-    /**
-     * @see com.metamatrix.connector.jdbc.JDBCSourceConnectionFactory#getConnectionListener()
-     */
-    protected ConnectionListener getConnectionListener() {
-        return connectionListener;
-    }
-    
-    /**
-     * A connection listener strategy class, where gets called after the connection 
-     * is created and before connection is terminated.
-     */
-    private static class OracleConnectionListener extends DefaultConnectionListener{
-        //  Since this going to used inside a pool, we would like to report only once  
-        boolean alreadyReportedDetails = false;  
-                
-        /**
-         * log some debug information about the oracle driver being used.
-         * defect request 13979 & 13978
-         * @see com.metamatrix.connector.jdbc.ConnectionStrategy#afterConnectionCreation(java.sql.Connection)
-         */
-        public void afterConnectionCreation(Connection connection, ConnectorEnvironment env) {
-            super.afterConnectionCreation(connection, env);
-            
-            if (alreadyReportedDetails) {                
-                return;
-            }
-            
-            alreadyReportedDetails = true;            
-            String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_oracle_connection_details"); //$NON-NLS-1$
-            executeSQL(connection, env, "select * from v$instance", errorStr); //$NON-NLS-1$
-        }
-
-        /**
-         * Execute any SQL aginst the connection
-         * @param connection
-         * @param env
-         * @param sql
-         */
-        private void executeSQL(Connection connection, ConnectorEnvironment env, String sql, String errorStr) {    
-            ResultSet rs = null;
-            Statement stmt = null;
-            try {                
-                stmt = connection.createStatement();
-                rs = stmt.executeQuery(sql); 
-                
-                
-                int columnCount = rs.getMetaData().getColumnCount();
-                while (rs.next()) {
-                    StringBuffer sb = new StringBuffer();
-                    for (int i = 1; i <= columnCount; i++) {
-                        sb.append(rs.getMetaData().getColumnName(i)).append("=").append(rs.getString(i)).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
-                    }                    
-                    // log the queried information
-                    env.getLogger().logInfo(sb.toString());                    
-                }                
-                
-            } catch (SQLException e) {
-                env.getLogger().logInfo(errorStr); 
-            }finally {
-                try {
-                    if (rs != null) {
-                        rs.close();
-                    } 
-                    if (stmt != null) {
-                        stmt.close();
-                    }
-                } catch (SQLException e1) {
-                    env.getLogger().logInfo(errorStr);
-                }
-            }
-        }        
-    }
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleUserIdentityConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleUserIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleUserIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.oracle;
-
-import com.metamatrix.connector.jdbc.*;
-import com.metamatrix.connector.jdbc.ConnectionStrategy;
-import com.metamatrix.connector.jdbc.JDBCUserIdentityConnectionFactory;
-
-public class OracleUserIdentityConnectionFactory extends JDBCUserIdentityConnectionFactory{
-    private String queryTest = "Select 'x' from DUAL"; //$NON-NLS-1$
-    
-    protected ConnectionStrategy createConnectionStrategy() {
-        return new ConnectionQueryStrategy(queryTest);        
-    }
-
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/DatePartFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/DatePartFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/DatePartFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -22,7 +22,7 @@
 
 package com.metamatrix.connector.jdbc.postgresql;
 
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,9 +27,9 @@
 import java.util.Arrays;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,17 +25,16 @@
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.util.Calendar;
 
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.SourceSystemFunctions;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
 import com.metamatrix.connector.jdbc.oracle.LeftOrRightFunctionModifier;
 import com.metamatrix.connector.jdbc.oracle.MonthOrDayNameFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.IAggregate;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ILimit;
@@ -46,7 +45,7 @@
 /** 
  * @since 4.3
  */
-public class PostgreSQLTranslator extends SQLTranslator {
+public class PostgreSQLTranslator extends Translator {
 
     public void initialize(ConnectorEnvironment env) throws ConnectorException {
         
@@ -88,18 +87,18 @@
     }
 
     @Override
-    public String translateLiteralDate(Date dateValue, Calendar cal) {
-        return "DATE '" + formatDateValue(dateValue, cal) + "'"; //$NON-NLS-1$//$NON-NLS-2$
+    public String translateLiteralDate(Date dateValue) {
+        return "DATE '" + formatDateValue(dateValue) + "'"; //$NON-NLS-1$//$NON-NLS-2$
     }
 
     @Override
-    public String translateLiteralTime(Time timeValue, Calendar cal) {
-        return "TIME '" + formatDateValue(timeValue, cal) + "'"; //$NON-NLS-1$//$NON-NLS-2$
+    public String translateLiteralTime(Time timeValue) {
+        return "TIME '" + formatDateValue(timeValue) + "'"; //$NON-NLS-1$//$NON-NLS-2$
     }
     
     @Override
-    public String translateLiteralTimestamp(Timestamp timestampValue, Calendar cal) {
-        return "to_timestamp('" + formatDateValue(timestampValue, cal) + "', 'YYYY-MM-DD HH24:MI:SS.US')"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    public String translateLiteralTimestamp(Timestamp timestampValue) {
+        return "to_timestamp('" + formatDateValue(timestampValue) + "', 'YYYY-MM-DD HH24:MI:SS.US')"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
     }
     
     @Override

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/SqlServerSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/SqlServerSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,9 +27,8 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
 import com.metamatrix.connector.jdbc.sybase.SybaseSQLTranslator;
-import com.metamatrix.connector.language.ILimit;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
 
 /**
  */
@@ -37,7 +36,7 @@
 
     public void initialize(ConnectorEnvironment env) throws ConnectorException {
         super.initialize(env);
-        //FEDERATE-168 remove mod modifier for SQL Server 2008
+        //TEIID-31 remove mod modifier for SQL Server 2008
         registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ //$NON-NLS-2$
         registerFunctionModifier(SourceSystemFunctions.REPEAT, new AliasModifier("replicate")); //$NON-NLS-1$ //$NON-NLS-2$
     }
@@ -46,10 +45,5 @@
     public String getLengthFunctionName() {
     	return "len"; //$NON-NLS-1$
     }
-    
-    @Override
-    public String addLimitString(String queryCommand, ILimit limit) {
-    	return "SELECT TOP " + limit.getRowLimit() + " * FROM (" + queryCommand + ") AS X"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
+    
 }

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl/JDBCSequeLinkSingleIdentityConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl/JDBCSequeLinkSingleIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl/JDBCSequeLinkSingleIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- * com.metamatrix.connector.jdbc.ssl.JDBCSequeLinkSingleIdentityConnectionFactory
- * Created by JChoate on Jan 28, 2005
- * (c) 2005 MetaMatrix, Inc.
- */
-package com.metamatrix.connector.jdbc.ssl;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.ConnectionQueryStrategy;
-import com.metamatrix.connector.jdbc.ConnectionStrategy;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.jdbc.JDBCSingleIdentityConnectionFactory;
-import com.metamatrix.connector.jdbc.JDBCSourceConnection;
-
-public class JDBCSequeLinkSingleIdentityConnectionFactory extends
-		JDBCSingleIdentityConnectionFactory {
-	
-    private static final String JDBC_CAPABILITIES   = "com.metamatrix.connector.jdbc.JDBCCapabilities"; //$NON-NLS-1$
-    private static final String ORACLE_CAPABILITIES = "com.metamatrix.connector.jdbc.oracle.OracleCapabilities"; //$NON-NLS-1$
-    private static final String DB2_CAPABILITIES    = "com.metamatrix.connector.jdbc.db2.DB2Capabilities"; //$NON-NLS-1$
-    private static final String SYBASE_CAPABILITIES = "com.metamatrix.connector.jdbc.sybase.SybaseCapabilities"; //$NON-NLS-1$
-    private static final String SQLSERVER_CAPABILITIES = "com.metamatrix.connector.jdbc.sqlserver.SqlServerCapabilities"; //$NON-NLS-1$
-    
-    // Fix for Case 4049 - USTranscom
-    // By default we were not creating a connectionStrategy and therefore not testing connections
-    // when pulling them from the pool, this caused problems when the SequeLink proxy would go down
-    // and come back up since we never removed the bad connection. 
-    // Adding this logic lets us run the test query when getting connections from the pool. 
-    // This is a slight hack, ultimately we want to add an option to Oracle, DB2, etc.. connectorTypes
-    // to select ssl mode and remove this Connector type. 
-    protected ConnectionStrategy createConnectionStrategy() {
-
-        String capabilityClass = this.getConnectorEnvironment().getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, JDBC_CAPABILITIES); 
-        String queryTest = null;
-        
-        if (capabilityClass.equals(ORACLE_CAPABILITIES)) {
-            queryTest = "Select 'x' from DUAL"; //$NON-NLS-1$
-        } else if (capabilityClass.equals(DB2_CAPABILITIES)) {
-            queryTest = "Select 'x' from sysibm.systables where 1 = 2"; //$NON-NLS-1$
-        } else if (capabilityClass.equals(SYBASE_CAPABILITIES)) {
-            queryTest = "Select 'x'"; //$NON-NLS-1$
-        } else if (capabilityClass.equals(SQLSERVER_CAPABILITIES)) {
-            queryTest = "Select 'x'"; //$NON-NLS-1$
-        } else {
-            return null;
-        }
-        return new ConnectionQueryStrategy(queryTest);        
-    }
-
-    /**
-     * This creates a JDBC connection.
-     * It overrides the functionality in abstract class com.metamatrix.connector.jdbc.JDBCSourceConnectionFactory
-     * @throws ConnectorException  if there is an error establishing the connection.
-     */
-    protected com.metamatrix.connector.api.Connection createJDBCConnection(Driver driver, String url, int transactionIsolationLevel, Properties userProps) throws ConnectorException {
-        Connection connection = null;
-
-        // Connect
-        try {
-            connection = driver.connect(url, userProps);
-            if(transactionIsolationLevel != NO_ISOLATION_LEVEL_SET){
-                connection.setTransactionIsolation(transactionIsolationLevel);
-            }
-        } catch ( SQLException e ) {
-            throw new ConnectorException(e);
-        }
-
-        return new JDBCSourceConnection(connection, getConnectorEnvironment(), createConnectionStrategy(), getConnectionListener(), getResultsTranslator(), getSqlTranslator());
-    }
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/ModFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/ModFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/ModFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,7 +25,7 @@
 import java.util.List;
 
 import com.metamatrix.connector.api.TypeFacility.RUNTIME_TYPES;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,9 +25,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.*;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,13 +27,14 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.impl.AliasModifier;
-import com.metamatrix.connector.jdbc.extension.impl.SubstringFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.AliasModifier;
+import com.metamatrix.connector.jdbc.translator.SubstringFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.Translator;
+import com.metamatrix.connector.language.ILimit;
 
 /**
  */
-public class SybaseSQLTranslator extends SQLTranslator {
+public class SybaseSQLTranslator extends Translator {
     
     /* 
      * @see com.metamatrix.connector.jdbc.extension.SQLTranslator#initialize(com.metamatrix.data.api.ConnectorEnvironment, com.metamatrix.data.metadata.runtime.RuntimeMetadata)
@@ -62,6 +63,11 @@
     @Override
     public boolean hasTimeType() {
     	return false;
-    }
+    }
     
+    @Override
+    public String addLimitString(String queryCommand, ILimit limit) {
+    	return "SELECT TOP " + limit.getRowLimit() + " * FROM (" + queryCommand + ") AS X"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+    
 }

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/AliasModifier.java (from rev 475, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/impl/AliasModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/AliasModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/AliasModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package com.metamatrix.connector.jdbc.translator;
+
+import com.metamatrix.connector.language.*;
+
+/**
+ */
+public class AliasModifier extends BasicFunctionModifier {
+    // The alias to use
+    private String alias;
+        
+    /**
+     * Constructor that takes the alias to use for functions.
+     * @param alias The alias to replace the incoming function name with
+     */
+    public AliasModifier(String alias) {
+        this.alias = alias;    
+    }
+    
+    /**
+     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.connector.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        function.setName(alias);
+        return function;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/AliasModifier.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java (from rev 475, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/impl/BasicFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package com.metamatrix.connector.jdbc.translator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+
+/**
+ */
+public abstract class BasicFunctionModifier implements FunctionModifier {
+
+    /*
+     * Public sharing part for the mapping between class and type in format of Map<class->Integer>.
+     */
+    public static final int STRING = 0;
+    public static final int CHAR = 1;
+    public static final int BOOLEAN = 2;
+    public static final int BYTE = 3;
+    public static final int SHORT = 4;
+    public static final int INTEGER = 5;
+    public static final int LONG = 6;
+    public static final int BIGINTEGER = 7;
+    public static final int FLOAT = 8;
+    public static final int DOUBLE = 9;
+    public static final int BIGDECIMAL = 10;
+    public static final int DATE = 11;
+    public static final int TIME = 12;
+    public static final int TIMESTAMP = 13;
+    public static final int OBJECT = 14;
+    public static final int BLOB = 15;
+    public static final int CLOB = 16;
+    public static final int XML = 17;
+
+    public static final Map typeMap = new HashMap();
+    
+    static {
+        typeMap.put(TypeFacility.RUNTIME_TYPES.STRING, new Integer(STRING));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.CHAR, new Integer(CHAR));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BOOLEAN, new Integer(BOOLEAN));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BYTE, new Integer(BYTE));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.SHORT, new Integer(SHORT));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.INTEGER, new Integer(INTEGER));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.LONG, new Integer(LONG));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BIG_INTEGER, new Integer(BIGINTEGER));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.FLOAT, new Integer(FLOAT));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.DOUBLE, new Integer(DOUBLE));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL, new Integer(BIGDECIMAL));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.DATE, new Integer(DATE));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.TIME, new Integer(TIME));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.TIMESTAMP, new Integer(TIMESTAMP));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.OBJECT, new Integer(OBJECT));        
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BLOB, new Integer(BLOB));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.XML, new Integer(XML));
+    }    
+    
+    /**
+     * Subclass should override this method as needed.
+     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.connector.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        return function;
+    }
+
+    /**
+     * Subclass should override this method as needed.
+     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     */
+    public List translate(IFunction function) {
+        List objs = new ArrayList();
+        objs.add(function.getName());
+        objs.add("("); //$NON-NLS-1$
+        IExpression[] params = function.getParameters();
+        if(params.length > 0) { 
+            objs.add(params[0]);
+            if(params.length > 1) {
+                for(int i=1; i<params.length; i++) {
+                    objs.add(", "); //$NON-NLS-1$
+                    objs.add(params[i]);
+                }
+            }
+        }
+        objs.add(")"); //$NON-NLS-1$
+
+        return objs;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BindValueVisitor.java (from rev 476, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/BindValueVisitor.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BindValueVisitor.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BindValueVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.jdbc.translator;
+
+import com.metamatrix.connector.language.ICompareCriteria;
+import com.metamatrix.connector.language.IExistsCriteria;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.IInCriteria;
+import com.metamatrix.connector.language.IInlineView;
+import com.metamatrix.connector.language.IInsert;
+import com.metamatrix.connector.language.ILanguageObject;
+import com.metamatrix.connector.language.ILikeCriteria;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.IScalarSubquery;
+import com.metamatrix.connector.language.ISearchedCaseExpression;
+import com.metamatrix.connector.language.ISetClause;
+import com.metamatrix.connector.language.ISubqueryCompareCriteria;
+import com.metamatrix.connector.visitor.framework.HierarchyVisitor;
+
+/**
+ * This visitor will mark literals in well known locations as bindValues.
+ * These values will be put in the generated SQL as ? 
+ * and have the corresponding value set on the PreparedStatement 
+ */
+final class BindValueVisitor extends HierarchyVisitor {
+
+    private boolean replaceWithBinding = false;
+
+    public void visit(IInlineView obj) {
+        replaceWithBinding = false;
+        visitNode(obj.getQuery());
+    }
+
+    public void visit(IScalarSubquery obj) {
+        replaceWithBinding = false;
+        super.visit(obj);
+    }
+
+    public void visit(IExistsCriteria obj) {
+        replaceWithBinding = false;
+        super.visit(obj);
+    }
+
+    public void visit(ISubqueryCompareCriteria obj) {
+        replaceWithBinding = false;
+        super.visit(obj);
+    }
+
+    /**
+     * In general it is not appropriate to use bind values within a function
+     * unless the particulars of the function parameters are know.  
+     * As needed, other visitors or modifiers can set the literals used within
+     * a particular function as bind variables.  
+     */
+    public void visit(IFunction obj) {
+        replaceWithBinding = false;
+        super.visit(obj);
+    }
+
+    public void visit(IInCriteria obj) {
+        replaceWithBinding = true;
+        visitNodes(obj.getRightExpressions());
+    }
+
+    public void visit(ILikeCriteria obj) {
+        replaceWithBinding = true;
+        visitNode(obj.getRightExpression());
+    }
+
+    /**
+     * Note that this will only visit the right expression.  In general most compares
+     * involving literals will be something like element = literal (this is enforced as
+     * much as possible by the QueryRewriter).  In rare circumstances, it is possible to
+     * have literal = literal (most notably null <> null).  Using bind variables on
+     * both sides of the operator is not supported by most databases.
+     */
+    public void visit(ICompareCriteria obj) {
+        replaceWithBinding = true;
+        visitNode(obj.getRightExpression());
+    }
+
+    /**
+     * Will look for bind values in the when criteria.
+     * The actual restriction for case statements seems to be that at least one branch must
+     * not contain a bind variable.
+     */
+    public void visit(ISearchedCaseExpression obj) {
+        for (int i = 0; i < obj.getWhenCount(); i++) {
+            visitNode(obj.getWhenCriteria(i));
+        }
+    }
+
+    @Override
+    public void visit(IInsert obj) {
+        replaceWithBinding = true;
+        visitNodes(obj.getValues());
+    }
+    
+    @Override
+    public void visit(ISetClause obj) {
+        replaceWithBinding = true;
+        visitNode(obj.getValue());
+    }
+
+    public void visit(ILiteral obj) {
+        if (replaceWithBinding || TranslatedCommand.isBindEligible(obj)) {
+            obj.setBindValue(true);
+        }
+    }
+    
+    public void visitNode(ILanguageObject obj) {
+        boolean replacementMode = replaceWithBinding;
+        super.visitNode(obj);
+        this.replaceWithBinding = replacementMode;
+    }
+}
\ No newline at end of file


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BindValueVisitor.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java (from rev 475, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/impl/DropFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.jdbc.translator;
+
+import com.metamatrix.connector.jdbc.JDBCPlugin;
+import com.metamatrix.connector.language.*;
+
+/**
+ * This FunctionModifier will cause this function to be dropped by replacing the function
+ * with (by default) the first argument of the function.  Optionally, the replacement index 
+ * can be overridden.  This modifier should only be used with functions having the
+ * minimum or more number of arguments. 
+ */
+public class DropFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+
+    private int replaceIndex = 0;
+    
+    public void setReplaceIndex(int index) {
+        this.replaceIndex = index;
+    }
+    
+    public IExpression modify(IFunction function) {
+        IExpression[] args = function.getParameters();
+        if(args.length <= replaceIndex) { 
+            throw new IllegalArgumentException(JDBCPlugin.Util.getString("DropFunctionModifier.DropFunctionModifier_can_only_be_used_on_functions_with___1") + function); //$NON-NLS-1$
+        }
+
+        return args[replaceIndex];
+    }
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/EscapeSyntaxModifier.java (from rev 475, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/impl/EscapeSyntaxModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/EscapeSyntaxModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/EscapeSyntaxModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.jdbc.translator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.metamatrix.connector.language.IFunction;
+
+/**
+ * Wrap a function in standard JDBC escape syntax.  In some cases, the 
+ * driver can then convert to the correct database syntax for us. 
+ * @since 5.0
+ */
+public class EscapeSyntaxModifier extends BasicFunctionModifier {
+
+    public EscapeSyntaxModifier() {
+        super();
+    }
+    
+    /** 
+     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     * @since 5.0
+     */
+    public List translate(IFunction function) {
+        List normalParts = super.translate(function);
+        List wrappedParts = new ArrayList(normalParts.size() + 2);
+        wrappedParts.add("{fn "); //$NON-NLS-1$
+        wrappedParts.addAll(normalParts);
+        wrappedParts.add("}"); //$NON-NLS-1$
+        return wrappedParts;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/EscapeSyntaxModifier.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/FunctionModifier.java (from rev 475, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/FunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/FunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/FunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package com.metamatrix.connector.jdbc.translator;
+
+import java.util.List;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+
+/**
+ * Implementations of this interface are used to modify metamatrix functions
+ * coming in to the connector into alternate datasource-specific language, if
+ * necessary. 
+ */
+public interface FunctionModifier {
+    
+    /**
+     * Takes an IFunction and returns the datasource-specific IExpression,
+     * or can possibly return the unmodified function parameter itself. 
+     * @param function
+     * @return IExpression or unmodified function
+     * @since 4.2
+     */
+    IExpression modify(IFunction function);
+    
+    /**
+     * Return a List of translated parts (LanguageObjects and Strings), or null
+     * if this FunctionModifier wishes to rely on the default translation of the
+     * conversion visitor. 
+     * @param function IFunction to be translated
+     * @return List of translated parts, or null
+     * @since 4.2
+     */
+    List translate(IFunction function);
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/FunctionModifier.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java (from rev 476, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLConversionVisitor.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,340 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package com.metamatrix.connector.jdbc.translator;
+
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IBulkInsert;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IElement;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageObject;
+import com.metamatrix.connector.language.ILimit;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.IParameter;
+import com.metamatrix.connector.language.IProcedure;
+import com.metamatrix.connector.language.IQuery;
+import com.metamatrix.connector.language.IQueryCommand;
+import com.metamatrix.connector.language.ISetQuery;
+import com.metamatrix.connector.language.IParameter.Direction;
+import com.metamatrix.connector.language.ISetQuery.Operation;
+import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
+import com.metamatrix.connector.visitor.util.SQLStringVisitor;
+
+/**
+ * This visitor takes an ICommand and does DBMS-specific conversion on it
+ * to produce a SQL String.  This class is expected to be subclassed.
+ * Specialized instances of this class can be gotten from a SQL Translator
+ * {@link Translator#getTranslationVisitor(RuntimeMetadata) using this method}.
+ */
+public class SQLConversionVisitor extends SQLStringVisitor{
+
+    private static DecimalFormat DECIMAL_FORMAT = 
+        new DecimalFormat("#############################0.0#############################"); //$NON-NLS-1$    
+    private static double SCIENTIC_LOW = Math.pow(10, -3);
+    private static double SCIENTIC_HIGH = Math.pow(10, 7);
+    
+    private Map<String, FunctionModifier> modifiers;
+    private ExecutionContext context;
+    private Translator translator;
+
+    private boolean prepared;
+    
+    private List preparedValues = new ArrayList();
+    private List preparedTypes = new ArrayList();
+    
+    public SQLConversionVisitor(Translator translator) {
+        this.translator = translator;
+        this.prepared = translator.usePreparedStatements();
+        this.modifiers = translator.getFunctionModifiers();
+    }
+
+    public void visit(IBulkInsert obj) {
+        this.prepared = true;
+
+        super.visit(obj);
+        
+        for (int i = 0; i < obj.getElements().size(); i++) {
+            IElement element = (IElement) obj.getElements().get(i);
+            this.preparedTypes.add(element.getType());
+        }
+
+        this.preparedValues = obj.getRows();
+    } 
+    
+    /**
+     * @param type
+     * @param object
+     * @param valuesbuffer
+     */
+    private void translateSQLType(Class type, Object obj, StringBuffer valuesbuffer) {
+        if (obj == null) {
+            valuesbuffer.append(NULL);
+        } else {
+            if(Number.class.isAssignableFrom(type)) {
+                boolean useFormatting = false;
+                
+                if (Double.class.isAssignableFrom(type)){
+                    double value = ((Double)obj).doubleValue();
+                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH); 
+                }
+                else if (Float.class.isAssignableFrom(type)){
+                    float value = ((Float)obj).floatValue();
+                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH);
+                }
+                // The formatting is to avoid the so-called "scientic-notation"
+                // where toString will use for numbers greater than 10p7 and
+                // less than 10p-3, where database may not understand.
+                if (useFormatting) {
+                	synchronized (DECIMAL_FORMAT) {
+                        valuesbuffer.append(DECIMAL_FORMAT.format(obj));
+					}
+                }
+                else {
+                    valuesbuffer.append(obj);
+                }
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
+                valuesbuffer.append(translator.translateLiteralBoolean((Boolean)obj));
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
+                valuesbuffer.append(translator.translateLiteralTimestamp((Timestamp)obj));
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
+                valuesbuffer.append(translator.translateLiteralTime((Time)obj));
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
+                valuesbuffer.append(translator.translateLiteralDate((java.sql.Date)obj));
+            } else {
+                // If obj is string, toSting() will not create a new String 
+                // object, it returns it self, so new object creation. 
+                valuesbuffer.append("'") //$NON-NLS-1$
+                      .append(escapeString(obj.toString()))
+                      .append("'"); //$NON-NLS-1$
+            }
+        }        
+    }
+
+    /**
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IProcedure)
+     */
+    public void visit(IProcedure obj) {
+        this.prepared = true;
+        /*
+         * preparedValues is now a list of procedure params instead of just values
+         */
+        this.preparedValues = obj.getParameters();
+        super.buffer.append(generateSqlForStoredProcedure(obj));
+    }
+
+    /**
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IFunction)
+     */
+    public void visit(IFunction obj) {
+        if(this.modifiers != null) {
+            FunctionModifier functionModifier = (FunctionModifier)this.modifiers.get(obj.getName().toLowerCase());
+            if(functionModifier != null) {
+                List parts = functionModifier.translate(obj);
+                
+                // null means the FunctionModifier will rely on default translation
+                if (parts != null) {
+                    Iterator iter = parts.iterator();
+                    while(iter.hasNext()) {
+                        Object part = iter.next();
+                        if(part instanceof String) {
+                            buffer.append(part);
+                        } else {
+                            append((ILanguageObject)part);
+                        }
+                    }
+                    return;
+                } 
+            } 
+        } 
+        super.visit(obj);
+    }
+
+    /**
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.ILiteral)
+     */
+    public void visit(ILiteral obj) {
+        if (this.prepared && obj.isBindValue()) {
+            buffer.append(UNDEFINED_PARAM);
+            preparedValues.add(obj.getValue());
+            preparedTypes.add(obj.getType());
+        } else {
+            translateSQLType(obj.getType(), obj.getValue(), buffer);
+        }
+    }
+
+    /**
+     * Set the per-command execution context on this visitor. 
+     * @param context ExecutionContext
+     * @since 4.3
+     */
+    public void setExecutionContext(ExecutionContext context) {
+        this.context = context;
+    }
+    
+    /**
+     * Retrieve the per-command execution context for this visitor 
+     * (intended for subclasses to use).
+     * @return
+     * @since 4.3
+     */
+    protected ExecutionContext getExecutionContext() {
+        return this.context;
+    }
+
+    protected String getSourceComment(ICommand command) {
+    	return this.translator.getSourceComment(this.context, command);
+    }
+    
+    /**
+     * This is a generic implementation. Subclass should override this method
+     * if necessary.
+     * @param exec The command for the stored procedure.
+     * @return String to be executed by CallableStatement.
+     */
+    protected String generateSqlForStoredProcedure(IProcedure exec) {
+        StringBuffer prepareCallBuffer = new StringBuffer();
+        prepareCallBuffer.append("{ "); //$NON-NLS-1$
+
+        List params = exec.getParameters();
+
+        //check whether a "?" is needed if there are returns
+        boolean needQuestionMark = false;
+        Iterator iter = params.iterator();
+        while(iter.hasNext()){
+            IParameter param = (IParameter)iter.next();
+            if(param.getDirection() == Direction.RETURN){
+                needQuestionMark = true;
+                break;
+            }
+        }
+        
+        prepareCallBuffer.append(getSourceComment(exec));
+        
+        if(needQuestionMark){
+            prepareCallBuffer.append("?="); //$NON-NLS-1$
+        }
+
+        prepareCallBuffer.append(" call ");//$NON-NLS-1$
+        prepareCallBuffer.append(exec.getMetadataID() != null ? getName(exec.getMetadataID()) : exec.getProcedureName());
+        prepareCallBuffer.append("("); //$NON-NLS-1$
+
+        int numberOfParameters = 0;
+        iter = params.iterator();
+        while(iter.hasNext()){
+            IParameter param = (IParameter)iter.next();
+            if(param.getDirection() == Direction.IN || param.getDirection() == Direction.OUT || param.getDirection() == Direction.INOUT){
+                if(numberOfParameters > 0){
+                    prepareCallBuffer.append(","); //$NON-NLS-1$
+                }
+                prepareCallBuffer.append("?"); //$NON-NLS-1$
+                numberOfParameters++;
+            }
+        }
+        prepareCallBuffer.append(")"); //$NON-NLS-1$
+        prepareCallBuffer.append("}"); //$NON-NLS-1$
+        return prepareCallBuffer.toString();
+    }
+    
+    /** 
+     * @return the preparedValues
+     */
+    List getPreparedValues() {
+        return this.preparedValues;
+    }
+    
+    /** 
+     * @return the preparedValues
+     */
+    List getPreparedTypes() {
+        return this.preparedTypes;
+    }
+    
+    public boolean isPrepared() {
+		return prepared;
+	}
+    
+    public void setPrepared(boolean prepared) {
+		this.prepared = prepared;
+	}
+    
+    @Override
+    protected boolean useAsInGroupAlias() {
+    	return this.translator.useAsInGroupAlias();
+    }
+    
+    @Override
+    public void visit(IQuery obj) {
+    	if (obj.getLimit() != null) {
+    		handleLimit(obj);
+    	} else {
+    		super.visit(obj);
+    	}
+    }
+    
+    @Override
+    public void visit(ISetQuery obj) {
+    	if (obj.getLimit() != null) {
+    		handleLimit(obj);
+    	} else {
+    		super.visit(obj);
+    	}
+    }
+    
+    @Override
+    protected boolean useParensForSetQueries() {
+    	return translator.useParensForSetQueries();
+    }
+    
+	private void handleLimit(IQueryCommand obj) {
+		ILimit limit = obj.getLimit();
+    	obj.setLimit(null);
+    	StringBuffer current = this.buffer;
+    	this.buffer = new StringBuffer();
+    	append(obj);
+    	current.append(this.translator.addLimitString(this.buffer.toString(), limit));
+    	this.buffer = current;
+    	obj.setLimit(limit);
+	}
+	
+	@Override
+	protected String replaceElementName(String group, String element) {
+		return translator.replaceElementName(group, element);
+	}
+	
+	@Override
+	protected void appendSetOperation(Operation operation) {
+		buffer.append(translator.getSetOperationString(operation));
+	}
+                
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java (from rev 475, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/impl/SubstringFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.jdbc.translator;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+/**
+ * Common logic for Substring modifiers requiring 3 parameters
+ */
+public class SubstringFunctionModifier extends BasicFunctionModifier {
+
+    private ILanguageFactory languageFactory;
+    private String length_function;
+    
+    public SubstringFunctionModifier(ILanguageFactory languageFactory, String substring_function, String length_function) {
+    	this.languageFactory = languageFactory; 
+        this.length_function = length_function;
+    }
+
+    /**
+     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.query.sql.symbol.Function)
+     */
+    public IExpression modify(IFunction function) {
+        IExpression[] args = function.getParameters();
+        IExpression[] newArgs = new IExpression[3];
+        function.setParameters(newArgs);
+
+        newArgs[0] = args[0];
+        newArgs[1] = args[1];
+        
+        if(args.length == 2) {
+            newArgs[2] = languageFactory.createFunction(length_function, new IExpression[] { args[0] }, Integer.class); 
+        } else {
+            newArgs[2] = args[2];
+        }
+        
+        function.setParameters(newArgs);
+                        
+        return function;
+    }
+}
\ No newline at end of file


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/TranslatedCommand.java (from rev 476, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/TranslatedCommand.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/TranslatedCommand.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/TranslatedCommand.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package com.metamatrix.connector.jdbc.translator;
+
+import java.util.List;
+import java.util.Map;
+
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.visitor.util.CollectorVisitor;
+
+/**
+ * This is a utility class used to translate an ICommand using a SQLConversionVisitor.
+ * The SQLConversionVisitor should not be invoked directly; this object will use it to
+ * translate the ICommand.
+ */
+public class TranslatedCommand {
+
+    private String sql;
+    private boolean prepared;
+    private List preparedValues;
+    private List preparedTypes;
+    
+    private SQLConversionVisitor sqlConversionVisitor;
+    private FunctionReplacementVisitor functionVisitor;
+    private ExecutionContext context;
+    private Translator sqlTranslator;
+    
+    /**
+     * Constructor, takes a SQLConversionVisitor subclass 
+     * @param visitor a SQLConversionVisitor subclass 
+     */
+    public TranslatedCommand(ExecutionContext context, Translator sqlTranslator){
+    	this.context = context;
+    	this.sqlTranslator = sqlTranslator;
+    	
+    	Map<String, FunctionModifier> modifiers = sqlTranslator.getFunctionModifiers();
+        this.sqlConversionVisitor = new SQLConversionVisitor(sqlTranslator);
+        sqlConversionVisitor.setExecutionContext(context);
+        this.functionVisitor = new FunctionReplacementVisitor(modifiers);
+    }
+    
+    public TranslatedCommand(ExecutionContext context, Translator sqlTranslator, SQLConversionVisitor sqlConversionVisitor, FunctionReplacementVisitor functionVisitor) {
+    	this.context = context;
+    	this.sqlTranslator = sqlTranslator;
+    	this.sqlConversionVisitor = sqlConversionVisitor;
+    	this.functionVisitor = functionVisitor;
+    }
+    
+    /**
+     * The method to cause this object to do it's thing.  This method should
+     * be called right after the constructor; afterward, all of the getter methods
+     * can be called to retrieve results. 
+     * @param command ICommand to be translated
+     * @throws ConnectorException 
+     */
+    public void translateCommand(ICommand command) throws ConnectorException {
+        this.sql = getSQL(command);
+        this.preparedValues = this.sqlConversionVisitor.getPreparedValues();
+        this.preparedTypes = this.sqlConversionVisitor.getPreparedTypes();
+        this.prepared = this.sqlConversionVisitor.isPrepared();
+    }
+	
+	private String getSQL(ICommand command) throws ConnectorException {
+        command = sqlTranslator.modifyCommand(command, context);
+		command.acceptVisitor(functionVisitor);
+        
+        if (sqlTranslator.usePreparedStatements() || hasBindValue(command)) {
+            this.sqlConversionVisitor.setPrepared(true);
+            
+            command.acceptVisitor(new BindValueVisitor());
+        }
+        
+		this.sqlConversionVisitor.append(command);
+		return this.sqlConversionVisitor.toString();
+	}
+
+    /**
+     * Simple check to see if any values in the command should be replaced with bind values
+     *  
+     * @param command
+     * @return
+     */
+    private boolean hasBindValue(ICommand command) {
+        for (ILiteral l : CollectorVisitor.collectObjects(ILiteral.class, command)) {
+            if (l.isBindValue() || isBindEligible(l)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /** 
+     * @param l
+     * @return
+     */
+    static boolean isBindEligible(ILiteral l) {
+        if (TypeFacility.RUNTIME_TYPES.CLOB.equals(l.getType())
+                        || TypeFacility.RUNTIME_TYPES.BLOB.equals(l.getType()) 
+                        || TypeFacility.RUNTIME_TYPES.OBJECT.equals(l.getType())) {
+            return true;
+        }
+        return false;
+    }
+    
+    /**
+     * Return List of values to set on a prepared statement, if 
+     * necessary (see {@link #getStatementType})
+     * @return List of values to be set on a prepared statement
+     */
+    public List getPreparedValues() {
+        return preparedValues;
+    }
+    
+    /**
+     * Return List of types to set on a prepared statement, if 
+     * necessary (see {@link #getStatementType})
+     * @return List of types to be set on a prepared statement
+     */
+    public List getPreparedTypes() {
+        return preparedTypes;
+    }
+
+    /**
+     * Get String SQL of translated command; but use 
+     * {@link #nextLargeSetQuerySQL} if this command is 
+     * a {@link #isLargeSetQuery large set query}
+     * @return SQL of translated command, or null if the
+     * command is a {@link #isLargeSetQuery large set query}
+     */
+    public String getSql() {
+        return sql;
+    }
+
+    /**
+     * Return the statement type, one of {@link #STMT_TYPE_STATEMENT},
+     * {@link #STMT_TYPE_PREPARED_STATEMENT}, or
+     * {@link #STMT_TYPE_CALLABLE_STATEMENT}
+     * @return statement type of translated command
+     */
+    public boolean isPrepared() {
+        return prepared;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/TranslatedCommand.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/Translator.java (from rev 476, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/extension/SQLTranslator.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/Translator.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/Translator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -0,0 +1,714 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.jdbc.translator;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.api.ValueTranslator;
+import com.metamatrix.connector.internal.ConnectorPropertyNames;
+import com.metamatrix.connector.jdbc.JDBCPlugin;
+import com.metamatrix.connector.jdbc.JDBCPropertyNames;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILimit;
+import com.metamatrix.connector.language.IParameter;
+import com.metamatrix.connector.language.ISetQuery;
+import com.metamatrix.connector.language.IParameter.Direction;
+
+/**
+ * Base class for creating source SQL queries and retrieving results.
+ * Specific databases should override as necessary.
+ */
+public class Translator {
+
+	// Because the retrieveValue() method will be hit for every value of 
+    // every JDBC result set returned, we do lots of weird special stuff here 
+    // to improve the performance (most importantly to remove big if/else checks
+    // of every possible type.  
+    
+    private static final Map<Class<?>, Integer> TYPE_CODE_MAP = new HashMap<Class<?>, Integer>();
+    
+    private static final int INTEGER_CODE = 0;
+    private static final int LONG_CODE = 1;
+    private static final int DOUBLE_CODE = 2;
+    private static final int BIGDECIMAL_CODE = 3;
+    private static final int SHORT_CODE = 4;
+    private static final int FLOAT_CODE = 5;
+    private static final int TIME_CODE = 6;
+    private static final int DATE_CODE = 7;
+    private static final int TIMESTAMP_CODE = 8;
+    private static final int BLOB_CODE = 9;
+    private static final int CLOB_CODE = 10;
+    
+    static {
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.INTEGER, new Integer(INTEGER_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.LONG, new Integer(LONG_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.DOUBLE, new Integer(DOUBLE_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL, new Integer(BIGDECIMAL_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.SHORT, new Integer(SHORT_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.FLOAT, new Integer(FLOAT_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.TIME, new Integer(TIME_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.DATE, new Integer(DATE_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.TIMESTAMP, new Integer(TIMESTAMP_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BLOB, new Integer(BLOB_CODE));
+        TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB_CODE));
+    }
+	
+    private static final MessageFormat COMMENT = new MessageFormat("/*teiid sessionid:{0}, requestid:{1}.{2}*/ "); //$NON-NLS-1$
+    public final static TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
+
+    private static final ThreadLocal<Calendar> CALENDAR = new ThreadLocal<Calendar>();
+
+	private Map<String, FunctionModifier> functionModifiers = new HashMap<String, FunctionModifier>();
+    private TimeZone databaseTimeZone;
+    private ConnectorEnvironment environment;
+    
+    private boolean useComments;
+    private boolean usePreparedStatements;
+    
+    private List<ValueTranslator<?, ?>> valueTranslators = new ArrayList<ValueTranslator<?, ?>>();
+    private int maxResultRows = 0;
+    private TypeFacility typeFacility;
+
+    private volatile boolean initialConnection;
+    private String connectionTestQuery;
+    private int isValidTimeout = -1;
+    
+    /**
+     * Initialize the SQLTranslator.
+     * @param env
+     * @param metadata
+     * @throws ConnectorException
+     */
+    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+        this.environment = env;
+        this.typeFacility = env.getTypeFacility();
+
+        String timeZone = env.getProperties().getProperty(JDBCPropertyNames.DATABASE_TIME_ZONE);
+        if(timeZone != null && timeZone.trim().length() > 0) {
+        	TimeZone tz = TimeZone.getTimeZone(timeZone);
+            // Check that the dbms time zone is really different than the local time zone
+            if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) {
+                this.databaseTimeZone = tz;                
+            }               
+        }   
+        
+        this.useComments = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, false);
+        this.usePreparedStatements = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_BIND_VARIABLES, false);
+    	this.connectionTestQuery = env.getProperties().getProperty(JDBCPropertyNames.CONNECTION_TEST_QUERY, getDefaultConnectionTestQuery());
+    	this.isValidTimeout = PropertiesUtils.getIntProperty(env.getProperties(), JDBCPropertyNames.IS_VALID_TIMEOUT, -1);
+    		
+    	String maxResultRowsString = env.getProperties().getProperty(ConnectorPropertyNames.MAX_RESULT_ROWS);
+        if ( maxResultRowsString != null && maxResultRowsString.trim().length() > 0 ) {
+            try {
+                maxResultRows = Integer.parseInt(maxResultRowsString);
+                String exceptionOnMaxRowsString = env.getProperties().getProperty(
+                        ConnectorPropertyNames.EXCEPTION_ON_MAX_ROWS);
+                maxResultRows = Math.max(0, maxResultRows);
+                //if the connector work needs to throw an excpetion, set the size plus 1
+                if (maxResultRows > 0 && Boolean.valueOf(exceptionOnMaxRowsString).booleanValue()) {
+                	maxResultRows++;
+                }
+            } catch (NumberFormatException e) {
+                //this will already be logged by the connector worker
+            }
+        }
+    }
+    
+    public TimeZone getDatabaseTimeZone() {
+		return databaseTimeZone;
+	}
+    
+    public Calendar getDatabaseCalendar() {
+    	if (this.databaseTimeZone == null) {
+    		return null;
+    	}
+    	Calendar cal = CALENDAR.get();
+    	if (cal == null) {
+    		cal = Calendar.getInstance(this.databaseTimeZone);
+    		CALENDAR.set(cal);
+    	}
+    	return cal;
+    }
+    
+    public final ConnectorEnvironment getEnvironment() {
+		return environment;
+	}
+    
+    public final ILanguageFactory getLanguageFactory() {
+    	return environment.getLanguageFactory();
+    }
+    
+    /**
+     * Modify the command.
+     * @param command
+     * @param context
+     * @return
+     */
+    public ICommand modifyCommand(ICommand command, ExecutionContext context) throws ConnectorException {
+    	return command;
+    }
+    
+    /**
+     * Return a map of function name in lower case to FunctionModifier.
+     * @return Map of function name to FunctionModifier.
+     */
+    public Map<String, FunctionModifier> getFunctionModifiers() {
+    	return functionModifiers;
+    }
+    
+    public void registerFunctionModifier(String name, FunctionModifier modifier) {
+    	this.functionModifiers.put(name, modifier);
+    }
+    
+    public void registerValueTranslator(ValueTranslator<?, ?> translator) {
+    	this.valueTranslators.add(translator);
+    }
+    
+    /**
+     * Subclasses should override this method to provide a different sql translation
+     * of the literal boolean value.  By default, a boolean literal is represented as:
+     * <code>'0'</code> or <code>'1'</code>.
+     * @param booleanValue Boolean value, never null
+     * @return Translated string
+     */
+    public String translateLiteralBoolean(Boolean booleanValue) {
+        if(booleanValue.booleanValue()) {
+            return "1"; //$NON-NLS-1$
+        }
+        return "0"; //$NON-NLS-1$
+    }
+
+    /**
+     * Subclasses should override this method to provide a different sql translation
+     * of the literal date value.  By default, a date literal is represented as:
+     * <code>{d'2002-12-31'}</code>
+     * @param dateValue Date value, never null
+     * @return Translated string
+     */
+    public String translateLiteralDate(java.sql.Date dateValue) {
+        return "{d'" + formatDateValue(dateValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Subclasses should override this method to provide a different sql translation
+     * of the literal time value.  By default, a time literal is represented as:
+     * <code>{t'23:59:59'}</code>
+     * @param timeValue Time value, never null
+     * @return Translated string
+     */
+    public String translateLiteralTime(Time timeValue) {
+    	if (!hasTimeType()) {
+    		return "{ts'1970-01-01 " + formatDateValue(timeValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+    	}
+        return "{t'" + formatDateValue(timeValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    /**
+     * Subclasses should override this method to provide a different sql translation
+     * of the literal timestamp value.  By default, a timestamp literal is
+     * represented as: <code>{ts'2002-12-31 23:59:59'}</code>.
+     * @param timestampValue Timestamp value, never null
+     * @return Translated string
+     */
+    public String translateLiteralTimestamp(Timestamp timestampValue) {
+        return "{ts'" + formatDateValue(timestampValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    /**
+     * Format the dateObject (of type date, time, or timestamp) into a string
+     * using the DatabaseTimeZone format.
+     * @param dateObject
+     * @return Formatted string
+     */
+    public String formatDateValue(java.util.Date dateObject) {
+        if (dateObject instanceof Timestamp && getTimestampNanoSecondPrecision() < 9) {
+        	Timestamp ts = (Timestamp)dateObject;
+        	Timestamp newTs = new Timestamp(ts.getTime());
+        	if (getTimestampNanoSecondPrecision() > 0) {
+	        	int mask = 10^(9-getTimestampNanoSecondPrecision());
+	        	newTs.setNanos(ts.getNanos()/mask*mask);
+        	}
+        	dateObject = newTs;
+        }
+    	Calendar cal = getDatabaseCalendar();
+    	if(cal == null) {
+            return dateObject.toString();
+        }
+        
+        return getEnvironment().getTypeFacility().convertDate(dateObject,
+				DEFAULT_TIME_ZONE, cal, dateObject.getClass()).toString();        
+    }    
+    
+    public boolean addSourceComment() {
+        return useComments;
+    }   
+    
+    public String addLimitString(String queryCommand, ILimit limit) {
+    	return queryCommand + " " + limit.toString(); //$NON-NLS-1$
+    }
+    
+    /**
+     * Indicates whether group alias should be of the form
+     * "...FROM groupA AS X" or "...FROM groupA X".  Certain
+     * data sources (such as Oracle) may not support the first
+     * form. 
+     * @return boolean
+     */
+    public boolean useAsInGroupAlias(){
+        return true;
+    }
+    
+    public boolean usePreparedStatements() {
+    	return this.usePreparedStatements;
+    }
+    
+    public boolean useParensForSetQueries() {
+    	return false;
+    }
+    
+    public boolean hasTimeType() {
+    	return true;
+    }
+    
+    public String getSetOperationString(ISetQuery.Operation operation) {
+    	return operation.toString();
+    }
+    
+    public String getSourceComment(ExecutionContext context, ICommand command) {
+	    if (addSourceComment() && context != null) {
+	    	synchronized (COMMENT) {
+	            return COMMENT.format(new Object[] {context.getConnectionIdentifier(), context.getRequestIdentifier(), context.getPartIdentifier()});
+			}
+	    }
+	    return ""; //$NON-NLS-1$ 
+    }
+    
+    public String replaceElementName(String group, String element) {
+    	return null;
+    }
+    
+    public int getTimestampNanoSecondPrecision() {
+    	return 9;
+    }
+    
+    public String getConnectionTestQuery() {
+		return connectionTestQuery;
+	}
+    
+    public String getDefaultConnectionTestQuery() {
+    	return "select 1"; //$NON-NLS-1$
+    }
+    
+    public TypeFacility getTypeFacility() {
+    	return typeFacility;
+    }
+    
+    /**
+     * This is a generic implementation. Because different databases handle
+     * stored procedures differently, subclasses should override this method
+     * if necessary.
+     */
+    public ResultSet executeStoredProcedure(CallableStatement statement, TranslatedCommand command) throws SQLException {
+        List params = command.getPreparedValues();
+        int index = 1;
+        
+        Iterator iter = params.iterator();
+        while(iter.hasNext()){
+            IParameter param = (IParameter)iter.next();
+            if(param.getDirection() == Direction.RETURN){
+                registerSpecificTypeOfOutParameter(statement,param, index++);
+            }
+        }
+        
+        iter = params.iterator();
+        while(iter.hasNext()){
+            IParameter param = (IParameter)iter.next();
+                    
+            if(param.getDirection() == Direction.INOUT){
+                registerSpecificTypeOfOutParameter(statement,param, index);
+            }else if(param.getDirection() == Direction.OUT){
+                registerSpecificTypeOfOutParameter(statement,param, index++);
+            }
+                    
+            if(param.getDirection() == Direction.IN || param.getDirection() == Direction.INOUT){
+                bindValue(statement, param.getValue(), param.getType(), index++);
+            }
+        }
+        
+        boolean resultSetNext = statement.execute();
+        
+        while (!resultSetNext) {
+            int update_count = statement.getUpdateCount();
+            if (update_count == -1) {
+                break;
+            }            
+            resultSetNext = statement.getMoreResults();
+        }
+        return statement.getResultSet();
+    }
+
+    /**
+     * @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#getValueTranslators()
+     */
+    public List getValueTranslators() {
+        return valueTranslators;
+    }
+    
+    /**
+     * For registering specific output parameter types we need to translate these into the appropriate
+     * java.sql.Types output parameters
+     * We will need to match these up with the appropriate standard sql types
+     * @param cstmt
+     * @param parameter
+     * @throws SQLException
+     */
+    protected void registerSpecificTypeOfOutParameter(CallableStatement statement, IParameter param, int index) throws SQLException {
+        Class runtimeType = param.getType();
+        int typeToSet = TypeFacility.getSQLTypeFromRuntimeType(runtimeType);
+        
+        statement.registerOutParameter(index,typeToSet);
+    }
+    
+    /**
+     * Will be called by Query and Update executions if a PreparedStatement is used.
+     * 
+     * bindValue is ultimately called from this method and for binding CallableStatement
+     * values, so subclasses should override that method if necessery to change the binding 
+     * behavior.
+     *  
+     * @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#bindPreparedStatementValues(java.sql.Connection, java.sql.PreparedStatement, com.metamatrix.connector.jdbc.translator.TranslatedCommand)
+     */
+    public void bindPreparedStatementValues(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException {
+        List params = command.getPreparedValues();
+        
+        setPreparedStatementValues(stmt, params, command.getPreparedTypes());
+    }
+
+    private void setPreparedStatementValues(PreparedStatement stmt, List paramValues, List paramTypes) throws SQLException {
+        Calendar cal = getDatabaseCalendar();
+    	for (int i = 0; i< paramValues.size(); i++) {
+            Object parmvalue = paramValues.get(i);
+            Class paramType = (Class)paramTypes.get(i);
+            // this means the params is one row
+            bindValue(stmt, parmvalue, paramType, i+1);
+        }          
+    }
+
+    /**
+     * Sets prepared statement parameter i with param.
+     * 
+     * Performs special handling to translate dates using the database time zone and to
+     * translate biginteger, float, and char to JDBC safe objects.
+     *  
+     * @param stmt
+     * @param param
+     * @param paramType
+     * @param i
+     * @param cal
+     * @throws SQLException
+     */
+    protected void bindValue(PreparedStatement stmt, Object param, Class paramType, int i) throws SQLException {
+        int type = TypeFacility.getSQLTypeFromRuntimeType(paramType);
+                
+        if (param == null) {
+            stmt.setNull(i, type);
+            return;
+        } 
+        //if this is a Date object, then use the database calendar
+        if (paramType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
+            stmt.setDate(i,(java.sql.Date)param, getDatabaseCalendar());
+            return;
+        } 
+        if (paramType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
+            stmt.setTime(i,(java.sql.Time)param, getDatabaseCalendar());
+            return;
+        } 
+        if (paramType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
+            stmt.setTimestamp(i,(java.sql.Timestamp)param, getDatabaseCalendar());
+            return;
+        }
+        //convert these the following to jdbc safe values
+        if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
+            param = new BigDecimal((BigInteger)param);
+        } else if (TypeFacility.RUNTIME_TYPES.FLOAT.equals(paramType)) {
+            param = new Double(((Float)param).doubleValue());
+        } else if (TypeFacility.RUNTIME_TYPES.CHAR.equals(paramType)) {
+            param = ((Character)param).toString();
+        }
+        stmt.setObject(i, param, type);
+    }
+    
+    public int executeStatementForBulkInsert(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException {
+        List rows = command.getPreparedValues();
+        Calendar cal = getDatabaseCalendar();
+        int updateCount = 0;
+        
+        for (int i = 0; i< rows.size(); i++) {
+            List row = (List) rows.get(i);
+             
+            setPreparedStatementValues(stmt, row, command.getPreparedTypes());
+            
+            stmt.addBatch();
+        }
+        
+        int[] results = stmt.executeBatch();
+        
+        for (int i=0; i<results.length; i++) {
+            updateCount += results[i];
+        }        
+        return updateCount;
+    } 
+
+    public List modifyRow(List batch, ExecutionContext context, ICommand command) {
+    	return batch;
+    }
+    
+	public int getMaxResultRows() {
+		return maxResultRows;
+	}
+    
+    /* 
+     * @see com.metamatrix.connector.jdbc.extension.ValueRetriever#retrieveValue(java.sql.ResultSet, int, java.lang.Class, java.util.Calendar)
+     */
+    public Object retrieveValue(ResultSet results, int columnIndex, Class expectedType) throws SQLException {
+        Integer code = (Integer) TYPE_CODE_MAP.get(expectedType);
+        if(code != null) {
+            // Calling the specific methods here is more likely to get uniform (and fast) results from different
+            // data sources as the driver likely knows the best and fastest way to convert from the underlying
+            // raw form of the data to the expected type.  We use a switch with codes in order without gaps
+            // as there is a special bytecode instruction that treats this case as a map such that not every value 
+            // needs to be tested, which means it is very fast.
+            switch(code.intValue()) {
+                case INTEGER_CODE:  {
+                    int value = results.getInt(columnIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    }
+                    return Integer.valueOf(value);
+                }
+                case LONG_CODE:  {
+                    long value = results.getLong(columnIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    } 
+                    return Long.valueOf(value);
+                }                
+                case DOUBLE_CODE:  {
+                    double value = results.getDouble(columnIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    } 
+                    return new Double(value);
+                }                
+                case BIGDECIMAL_CODE:  {
+                    return results.getBigDecimal(columnIndex); 
+                }
+                case SHORT_CODE:  {
+                    short value = results.getShort(columnIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    }                    
+                    return Short.valueOf(value);
+                }
+                case FLOAT_CODE:  {
+                    float value = results.getFloat(columnIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    } 
+                    return new Float(value);
+                }
+                case TIME_CODE: {
+                	return results.getTime(columnIndex, getDatabaseCalendar());
+                }
+                case DATE_CODE: {
+                    return results.getDate(columnIndex, getDatabaseCalendar());
+                }
+                case TIMESTAMP_CODE: {
+                    return results.getTimestamp(columnIndex, getDatabaseCalendar());
+                }
+    			case BLOB_CODE: {
+    				try {
+    					return typeFacility.convertToRuntimeType(results.getBlob(columnIndex));
+    				} catch (SQLException e) {
+    					// ignore
+    				}
+    				break;
+    			}
+    			case CLOB_CODE: {
+    				try {
+    					return typeFacility.convertToRuntimeType(results.getClob(columnIndex));
+    				} catch (SQLException e) {
+    					// ignore
+    				}
+    				break;
+    			}                
+            }
+        }
+
+        return typeFacility.convertToRuntimeType(results.getObject(columnIndex));
+    }
+
+    public Object retrieveValue(CallableStatement results, int parameterIndex, Class expectedType) throws SQLException{
+        Integer code = (Integer) TYPE_CODE_MAP.get(expectedType);
+        if(code != null) {
+            switch(code.intValue()) {
+                case INTEGER_CODE:  {
+                    int value = results.getInt(parameterIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    }
+                    return Integer.valueOf(value);
+                }
+                case LONG_CODE:  {
+                    long value = results.getLong(parameterIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    } 
+                    return Long.valueOf(value);
+                }                
+                case DOUBLE_CODE:  {
+                    double value = results.getDouble(parameterIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    } 
+                    return new Double(value);
+                }                
+                case BIGDECIMAL_CODE:  {
+                    return results.getBigDecimal(parameterIndex); 
+                }
+                case SHORT_CODE:  {
+                    short value = results.getShort(parameterIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    }                    
+                    return Short.valueOf(value);
+                }
+                case FLOAT_CODE:  {
+                    float value = results.getFloat(parameterIndex);                    
+                    if(results.wasNull()) {
+                        return null;
+                    } 
+                    return new Float(value);
+                }
+                case TIME_CODE: {
+                    try {
+                        return results.getTime(parameterIndex, getDatabaseCalendar());
+                    } catch (SQLException e) {
+                        //ignore
+                    }
+                }
+                case DATE_CODE: {
+                    try {
+                        return results.getDate(parameterIndex, getDatabaseCalendar());
+                    } catch (SQLException e) {
+                        //ignore
+                    }
+                }
+                case TIMESTAMP_CODE: {
+                    try {
+                        return results.getTimestamp(parameterIndex, getDatabaseCalendar());
+                    } catch (SQLException e) {
+                        //ignore
+                    }
+                }
+    			case BLOB_CODE: {
+    				try {
+    					return typeFacility.convertToRuntimeType(results.getBlob(parameterIndex));
+    				} catch (SQLException e) {
+    					// ignore
+    				}
+    			}
+    			case CLOB_CODE: {
+    				try {
+    					return typeFacility.convertToRuntimeType(results.getClob(parameterIndex));
+    				} catch (SQLException e) {
+    					// ignore
+    				}
+    			}
+            }
+        }
+
+        // otherwise fall through and call getObject() and rely on the normal
+		// translation routines
+		return typeFacility.convertToRuntimeType(results.getObject(parameterIndex));
+    }
+        
+    protected void afterInitialConnectionCreation(Connection connection) {
+        // now dig some details about this driver/database for log.
+        try {
+            StringBuffer sb = new StringBuffer();
+            DatabaseMetaData dbmd = connection.getMetaData();
+            sb.append("Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
+            sb.append(";DatabaseProductName=").append(dbmd.getDatabaseProductName()); //$NON-NLS-1$
+            sb.append(";DatabaseProductVersion=").append(dbmd.getDatabaseProductVersion()); //$NON-NLS-1$
+            sb.append(";DriverMajorVersion=").append(dbmd.getDriverMajorVersion()); //$NON-NLS-1$
+            sb.append(";DriverMajorVersion=").append(dbmd.getDriverMinorVersion()); //$NON-NLS-1$
+            sb.append(";DriverName=").append(dbmd.getDriverName()); //$NON-NLS-1$
+            sb.append(";DriverVersion=").append(dbmd.getDriverVersion()); //$NON-NLS-1$
+            sb.append(";IsolationLevel=").append(dbmd.getDefaultTransactionIsolation()); //$NON-NLS-1$
+            
+            getEnvironment().getLogger().logInfo(sb.toString());
+        } catch (SQLException e) {
+            String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_jdbc_connection_details"); //$NON-NLS-1$            
+            getEnvironment().getLogger().logInfo(errorStr); 
+        }
+    }
+    
+    /**
+     * defect request 13979 & 13978
+     */
+    public void afterConnectionCreation(Connection connection) {
+        if (initialConnection) {
+            initialConnection = false;
+            afterInitialConnectionCreation(connection);
+        }
+    }
+    
+    public int getIsValidTimeout() {
+		return isValidTimeout;
+	}
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/Translator.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/FunctionReplacementVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/FunctionReplacementVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/FunctionReplacementVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -26,7 +26,7 @@
 import java.util.List;
 import java.util.Map;
 
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
 import com.metamatrix.connector.language.IAggregate;
 import com.metamatrix.connector.language.ICompareCriteria;
 import com.metamatrix.connector.language.IExpression;

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSingleIdentityDSConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSingleIdentityDSConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSingleIdentityDSConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,178 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.xa;
-
-import java.lang.reflect.Method;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Iterator;
-import java.util.Properties;
-
-import javax.sql.DataSource;
-import javax.sql.XAConnection;
-import javax.sql.XADataSource;
-
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.jdbc.JDBCPlugin;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.jdbc.JDBCSingleIdentityConnectionFactory;
-import com.metamatrix.connector.pool.PoolAwareConnection;
-
-/**
- * JDBCSingleIdentityDSConnectionFactory
- *
- * <p>Creates connections from DataSources both XA and non-XA.</p>
- */
-public class JDBCSingleIdentityDSConnectionFactory extends JDBCSingleIdentityConnectionFactory{
-    private DataSource ds;
-    private String resourceName;
-
-    protected void verifyConnectionProperties(final Properties connectionProps) throws ConnectorException {
-        // Get the JDBC properties ...
-        String dataSourceClassName = connectionProps.getProperty(JDBCPropertyNames.DRIVER_CLASS);
-        String username = connectionProps.getProperty(XAJDBCPropertyNames.USER);
-        String password = connectionProps.getProperty(XAJDBCPropertyNames.PASSWORD);
-        String serverName = connectionProps.getProperty(XAJDBCPropertyNames.SERVER_NAME);
-        String serverPort = connectionProps.getProperty(XAJDBCPropertyNames.PORT_NUMBER);
-
-        // Unique resource name for this connector
-        final StringBuffer dataSourceResourceName = new StringBuffer(connectionProps.getProperty(XAJDBCPropertyNames.DATASOURCE_NAME, "XADS")); //$NON-NLS-1$
-        dataSourceResourceName.append('_'); 
-        dataSourceResourceName.append(serverName);
-        dataSourceResourceName.append('_'); 
-        dataSourceResourceName.append(connectionProps.getProperty(XAJDBCPropertyNames.CONNECTOR_ID));
-        resourceName = dataSourceResourceName.toString();
-        connectionProps.setProperty( XAJDBCPropertyNames.DATASOURCE_NAME, resourceName);
-
-        // Verify required items
-        if (dataSourceClassName == null || dataSourceClassName.trim().length() == 0) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_driver_class_name_1")); //$NON-NLS-1$
-        }
-        dataSourceClassName = dataSourceClassName.trim();
-        if ( serverName == null || serverName.trim().length() == 0 ) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
-                    XAJDBCPropertyNames.SERVER_NAME));
-        }
-        if ( serverPort == null || serverPort.trim().length() == 0 ) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
-                    XAJDBCPropertyNames.PORT_NUMBER));
-        }
-        if ( username == null || username.trim().length() == 0 ) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
-                    XAJDBCPropertyNames.USER));
-        }
-        if ( password == null || password.trim().length() == 0 ) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
-                    XAJDBCPropertyNames.PASSWORD));
-        }
-
-        // create data source
-        final DataSource baseDs;
-        try {
-        	Class clazz = Thread.currentThread().getContextClassLoader().loadClass(dataSourceClassName);
-            baseDs = (DataSource) clazz.newInstance();
-        } catch(Exception e) {
-            throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", dataSourceClassName)); //$NON-NLS-1$
-        }
-
-        setDSProperties(connectionProps, baseDs);
-
-        ds = baseDs;
-    }
-
-    @Override
-    public PoolAwareConnection getConnection(ExecutionContext context) throws ConnectorException {
-        try{
-            XAConnection conn = ((XADataSource)ds).getXAConnection();
-            Connection sqlConn = conn.getConnection();
-            if(getTransactionIsolation() != NO_ISOLATION_LEVEL_SET && getTransactionIsolation() != Connection.TRANSACTION_NONE){
-                sqlConn.setTransactionIsolation(getTransactionIsolation());
-            }
-            return new JDBCSourceXAConnection(sqlConn, conn, getConnectorEnvironment(), createConnectionStrategy(), getConnectionListener(), getResultsTranslator(), getSqlTranslator());
-        }catch(SQLException se){
-            throw new ConnectorException(se);
-        }
-    }
-
-    /**
-     * @param props
-     * @param dataSource
-     */
-    protected void setDSProperties(final Properties props, final DataSource dataSource) throws ConnectorException {
-        // Move all prop names to lower case so we can use reflection to get
-        // method names and look them up in the connection props.
-        final Properties connProps = lowerCaseAllPropNames(props);
-        final Method[] methods = dataSource.getClass().getMethods();
-        for (int i = 0; i < methods.length; i++) {
-            final Method method = methods[i];
-            final String methodName = method.getName();
-            // If setter ...
-            if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
-                // Get the property name
-                final String propertyName = methodName.substring(3);    // remove the "set"
-                final String propertyValue = (String) connProps.get(propertyName.toLowerCase());
-                if ( propertyValue != null ) {  
-                    final Class argType = method.getParameterTypes()[0];
-                    final Object[] params = new Object[1];
-                    if ( argType == Integer.TYPE ) {
-                        params[0] = Integer.decode(propertyValue);
-                    } else if ( argType == Boolean.TYPE ) {
-                        params[0] = Boolean.valueOf(propertyValue);
-                    } else if ( argType == String.class ) {
-                        params[0] = propertyValue;
-                    }
-
-                    // Actually set the property ...
-                    //getConnectorEnvironment().getLogger().logTrace("setDSProperties - Setting property \"" + propertyName +  //$NON-NLS-1$
-                    //                                               "\" = \"" + params[0] + "\" on \"" + props.getProperty(JDBCPropertyNames.DRIVER_CLASS) + "\"");                     //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-                    try {
-                        method.invoke(dataSource, params);
-                    } catch (Throwable e) {
-                        final Object[] msgParams = new Object[]{propertyName, propertyValue};
-                        final String msg = JDBCPlugin.Util.getString("JDBCSingleIdentityDSConnectionFactory.Unable_to_set_DataSource_property", msgParams); //$NON-NLS-1$
-                        throw new ConnectorException(msg); 
-                    }
-                }
-            }
-        }
-    }
-
-    private Properties lowerCaseAllPropNames(final Properties connectionProps) {
-        final Properties lcProps = new Properties();
-        final Iterator itr = connectionProps.keySet().iterator();
-        while ( itr.hasNext() ) {
-            final String name = (String) itr.next();
-            Object propValue = connectionProps.get(name);
-            if (propValue instanceof String) {
-                // we're only interested in prop values of type String
-                // here since we'll be looking for params to reflected methods
-                lcProps.setProperty(name.toLowerCase(), (String)propValue);
-            } // if
-        }
-        return lcProps;
-    }
-    
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSourceXAConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSourceXAConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSourceXAConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -33,11 +33,8 @@
 
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.ConnectionListener;
-import com.metamatrix.connector.jdbc.ConnectionStrategy;
 import com.metamatrix.connector.jdbc.JDBCSourceConnection;
-import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.xa.api.XAConnection;
 
 public class JDBCSourceXAConnection extends JDBCSourceConnection implements XAConnection {
@@ -45,8 +42,8 @@
     private XAResource resource;
     private boolean errorOccurred;
     
-    public JDBCSourceXAConnection(Connection conn, javax.sql.XAConnection xaConn, ConnectorEnvironment environment, ConnectionStrategy connectionStrategy, ConnectionListener connectionListener, ResultsTranslator resultsTranslator, SQLTranslator sqlTranslator) throws ConnectorException, SQLException {       
-        super(conn, environment, connectionStrategy, connectionListener, resultsTranslator, sqlTranslator);
+    public JDBCSourceXAConnection(Connection conn, javax.sql.XAConnection xaConn, ConnectorEnvironment environment, Translator sqlTranslator) throws ConnectorException, SQLException {       
+        super(conn, environment, sqlTranslator);
         this.xaConn = xaConn;
         this.xaConn.addConnectionEventListener(new ConnectionEventListener() {
         	@Override
@@ -84,7 +81,7 @@
      */
     @Override
     public void closeCalled() {
-    	super.closeCalled();
+    	closeSourceConnection();
     	try {
 			this.physicalConnection = this.xaConn.getConnection();
 		} catch (SQLException e) {
@@ -100,4 +97,8 @@
     	return super.isAlive();
     }
     
+    public javax.sql.XAConnection getXAConnection() {
+    	return this.xaConn;
+    }
+    
 }

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCXAConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCXAConnector.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCXAConnector.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package com.metamatrix.connector.jdbc.xa;
-
-import java.util.List;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.ConnectorAnnotations.ConnectionPooling;
-import com.metamatrix.connector.jdbc.JDBCConnector;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.xa.api.TransactionContext;
-import com.metamatrix.connector.xa.api.XAConnection;
-import com.metamatrix.connector.xa.api.XAConnector;
-import com.metamatrix.core.util.StringUtil;
-
- at ConnectionPooling
-public class JDBCXAConnector extends JDBCConnector implements XAConnector{
-
-	@Override
-	public void start(ConnectorEnvironment environment)
-			throws ConnectorException {
-        Properties appEnvProps = environment.getProperties();          
-
-        // Get and parse URL for some DataSource properties - add to connectionProps
-        final String url = appEnvProps.getProperty(JDBCPropertyNames.URL);
-        if ( url == null || url.trim().length() == 0 ) {
-            throw new ConnectorException("Missing required property: " + JDBCPropertyNames.URL); //$NON-NLS-1$
-        }
-        
-        parseURL(url, appEnvProps);
-
-        super.start(environment);
-
-        //TODO: this assumes single identity support
-        Connection conn = this.getXAConnection(null, null);
-        conn.close();
-    }
-    
-    /*
-     * @see com.metamatrix.data.api.xa.XAConnector#getXAConnection(com.metamatrix.data.api.SecurityContext)
-     */
-    public XAConnection getXAConnection(ExecutionContext context, final TransactionContext transactionContext) throws ConnectorException {
-    	return (XAConnection)this.getConnection(context);
-    }
-
-    /**
-     * Parse URL for DataSource connection properties and add to connectionProps.
-     * @param url
-     * @param connectionProps
-     */
-    static void parseURL(final String url, final Properties connectionProps) {
-        // Will be: [jdbc:mmx:dbType://aHost:aPort], [DatabaseName=aDataBase], [CollectionID=aCollectionID], ...
-        final List urlParts = StringUtil.split(url, ";"); //$NON-NLS-1$
-
-        // Will be: [jdbc:mmx:dbType:], [aHost:aPort]
-        final List protoHost = StringUtil.split((String)urlParts.get(0), "//"); //$NON-NLS-1$
-
-        // Will be: [aHost], [aPort]
-        final List hostPort = StringUtil.split((String) protoHost.get(1), ":"); //$NON-NLS-1$
-        connectionProps.setProperty(XAJDBCPropertyNames.SERVER_NAME, (String)hostPort.get(0));
-        connectionProps.setProperty(XAJDBCPropertyNames.PORT_NUMBER, (String)hostPort.get(1));
-
-        // For "databaseName", "SID", and all optional props
-        // (<propName1>=<propValue1>;<propName2>=<propValue2>;...)
-        for ( int i = 1; i < urlParts.size(); i++ ) {
-            final String nameVal = (String) urlParts.get( i );
-            // Will be: [propName], [propVal]
-            final List aProp = StringUtil.split(nameVal, "="); //$NON-NLS-1$
-            if ( aProp.size() > 1) {
-                final String propName = (String) aProp.get(0);
-                if ( propName.equalsIgnoreCase(XAJDBCPropertyNames.DATABASE_NAME) ) {
-                    connectionProps.setProperty(XAJDBCPropertyNames.DATABASE_NAME, (String) aProp.get(1));
-                } else {
-                    // Set optional prop names lower case so that we can find
-                    // set method names for them when we introspect the DataSource
-                    connectionProps.setProperty(propName.toLowerCase(), (String) aProp.get(1));
-                }
-            }
-        }
-    }
-}

Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/XAJDBCPropertyNames.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/XAJDBCPropertyNames.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/XAJDBCPropertyNames.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -31,59 +31,13 @@
  */
 public class XAJDBCPropertyNames {
 
-    /**
-     * The environment property used to identify a routing ID.  This value should
-     * be used to locate this particular connector from the DQP.
-     * @since 4.0
-     */
-    public static final String CONNECTOR_ID = "ConnectorID"; //$NON-NLS-1$
-
     /** An XA Transaction-related property. The <code>XADataSource</code>'s unique
      * resource name for the underlying <code>ConnectionPoolDataSource</code> object.
      */
     public static final String DATASOURCE_NAME = "dataSourceName"; //$NON-NLS-1$
 
-    public static final String DATABASE_NAME = "databaseName";//$NON-NLS-1$
-
-    public static final String DESCRIPTION = "description";//$NON-NLS-1$
-
-    public static final String NETWORK_PROTOCOL = "networkProtocol";//$NON-NLS-1$
-
-    public static final String PASSWORD = "password";//$NON-NLS-1$
-
     public static final String PORT_NUMBER = "portNumber";//$NON-NLS-1$
 
-    public static final String ROLE_NAME = "roleName";//$NON-NLS-1$
-
     public static final String SERVER_NAME = "serverName";//$NON-NLS-1$
 
-    public static final String USER = "user";//$NON-NLS-1$
-
-    /** <i>Not</i> a standard DataSource property - only for debugging */
-    public static final String SPYING = "spyAttributes";//$NON-NLS-1$
-
-    /**
-     * Oracle-specific properties
-     */
-    public static class Oracle {
-        public static final String SID = "sid";//$NON-NLS-1$
-    }
-
-    /**
-     * DB2-specific properties
-     */
-    public static class DB2 {
-        public static final String COLLECTIONID = "CollectionID";//$NON-NLS-1$
-        public static final String PACKAGENAME = "PackageName";//$NON-NLS-1$
-    }
-
-    public static final String IS_XA = "isXA";//$NON-NLS-1$
-    
-    /**
-     * If true, the XAConnection obtained from the pool will not be 
-     * returned until the transaction is finished. 
-     */
-    public static final String USE_CONNECTION_EXCLUSIVE = "UseConnectionExclusive"; //$NON-NLS-1$
-
-
 }

Deleted: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestConnectionQueryStrategy.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestConnectionQueryStrategy.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestConnectionQueryStrategy.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc;
-
-import java.sql.Connection;
-
-import com.metamatrix.core.util.SimpleMock;
-
-import junit.framework.TestCase;
-
-
-/** 
- * Test case for ConnectionQueryStrategy
- * @since 4.3
- */
-public class TestConnectionQueryStrategy extends TestCase {
-    
-    private final static String TEST_QUERY = "select 'x' from dual"; //$NON-NLS-1$
-    
-    private ConnectionQueryStrategy strategy;
-    private FakeConnection fakeConnection;
-    private Connection connection;
-    
-    public TestConnectionQueryStrategy(String name) {
-        super(name);
-    }
-    
-    public void setUp() throws Exception {
-        strategy = new ConnectionQueryStrategy(TEST_QUERY);
-        
-        fakeConnection = new FakeConnection();
-        connection = SimpleMock.createSimpleMock(fakeConnection, Connection.class);
-    }
-    
-
-    /**
-     * Tests ConnectionQueryStrategy.isConnectionAlive()
-     * @since 4.3
-     */
-    public void testIsConnectionAlive() {
-        //closed connections should not be 'alive'
-    	fakeConnection.closed = true;      
-        assertFalse(strategy.isConnectionAlive(connection));
-        
-        
-        //open connections should be 'alive'
-        fakeConnection.closed = false;      
-        assertTrue(strategy.isConnectionAlive(connection));
-        
-        //failed connections should not be 'alive'
-        fakeConnection.fail = true;     
-        assertFalse(strategy.isConnectionAlive(connection));
-        
-    }
-    
-}

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,8 +30,7 @@
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.basic.BasicConnectorCapabilities;
-import com.metamatrix.connector.jdbc.extension.impl.BasicResultsTranslator;
-import com.metamatrix.connector.jdbc.oracle.OracleSQLTranslator;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.core.util.SimpleMock;
 
 
@@ -41,18 +40,13 @@
  */
 public class TestJDBCSourceConnection extends TestCase {
     
-    private final static String TEST_QUERY = "select 'x' from dual"; //$NON-NLS-1$
-    
-    
     private FakeConnection fakeConnection;
     private Connection connection;
     private ConnectorEnvironment environment;
-    private ConnectionQueryStrategy strategy;
     
     
     public TestJDBCSourceConnection(String name) {
         super(name);
-        
     }
     
     public void setUp() throws Exception {
@@ -60,13 +54,9 @@
         connection = SimpleMock.createSimpleMock(fakeConnection, Connection.class);
 
         final Properties properties = new Properties();
-        properties.setProperty(JDBCPropertyNames.EXT_SQL_TRANSLATOR_CLASS, OracleSQLTranslator.class.getName()); 
-        properties.setProperty(JDBCPropertyNames.EXT_RESULTS_TRANSLATOR_CLASS, BasicResultsTranslator.class.getName());  
         properties.setProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, BasicConnectorCapabilities.class.getName());  
         
         environment = EnvironmentUtility.createEnvironment(properties, false); 
-        
-        strategy = new ConnectionQueryStrategy(TEST_QUERY);
     }
     
 
@@ -75,7 +65,12 @@
      * @since 4.3
      */
     public void testIsAlive() throws Exception {
-        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, strategy, null, null); 
+        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
+        	@Override
+        	public String getConnectionTestQuery() {
+        		return "select 1";
+        	}
+        }); 
         
         //closed connections should not be 'alive'        
         fakeConnection.closed = true;
@@ -96,7 +91,12 @@
      * @since 4.3
      */
     public void testIsAliveNullStrategy() throws Exception {
-        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, null, null, null); 
+        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
+        	@Override
+        	public String getConnectionTestQuery() {
+        		return null;
+        	}
+        }); 
         
         //closed connections should not be 'alive'        
         fakeConnection.closed = true;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access/TestAccessSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access/TestAccessSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access/TestAccessSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,8 +29,8 @@
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 
 
@@ -39,7 +39,7 @@
  */
 public class TestAccessSQLTranslator extends TestCase {
 
-    private static SQLTranslator TRANSLATOR; 
+    private static Translator TRANSLATOR; 
 
     static {
         try {

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2ConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -32,7 +32,7 @@
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2SqlTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2SqlTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2SqlTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -32,7 +32,7 @@
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.core.util.UnitTestUtil;
 

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/TestDerbyConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/TestDerbyConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/TestDerbyConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -32,7 +32,7 @@
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestDropFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestDropFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestDropFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,6 +25,7 @@
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILiteral;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -28,6 +28,7 @@
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.connector.jdbc.translator.EscapeSyntaxModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILiteral;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql/TestMySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql/TestMySQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql/TestMySQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,7 +30,7 @@
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.language.ICommand;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,7 +29,7 @@
 
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestExtractFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestExtractFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestExtractFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,7 +30,7 @@
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IElement;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -28,7 +28,7 @@
 
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLocateFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLocateFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLocateFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -28,7 +28,7 @@
 
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,7 +29,7 @@
 
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -32,7 +32,7 @@
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,13 +30,13 @@
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.jdbc.access.AccessSQLTranslator;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 
 public class TestOracleTranslator extends TestCase {
 	
-	private static SQLTranslator TRANSLATOR; 
+	private static Translator TRANSLATOR; 
 
     static {
         try {

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestSubstringFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,8 +29,8 @@
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.FunctionModifier;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.FunctionModifier;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql/TestPostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql/TestPostgreSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql/TestPostgreSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,7 +30,7 @@
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.language.ICommand;
 
 /**

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,8 +30,8 @@
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseConvertModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseConvertModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -32,7 +32,7 @@
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,8 +29,8 @@
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 

Deleted: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/MockExampleConnectionFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/MockExampleConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/MockExampleConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.userpool;
-
-import java.sql.Driver;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.JDBCUserIdentityConnectionFactory;
-
-/**
- * Overrides createConnection stuff so we can fake obtaining a connection.
- */
-public class MockExampleConnectionFactory extends JDBCUserIdentityConnectionFactory {
-
-    public void shutdown() {}
-	
-    @Override
-    protected Connection createJDBCConnection(
-        Driver driver,
-        String url,
-        int transactionIsolationLevel,
-        Properties userProps)
-        throws ConnectorException {
-            
-        String user = userProps.getProperty("user"); //$NON-NLS-1$
-        String password = userProps.getProperty("password"); //$NON-NLS-1$
-                    
-        return new MockSourceConnection(url, transactionIsolationLevel, user, password);            
-    }
-
-    @Override
-    protected Driver createDriver(String driverClassName) throws ConnectorException {
-    	return null;
-    }
-    
-    @Override
-    protected void validateURL(Driver driver, String url)
-    		throws ConnectorException {
-    }
-}

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/TestPerUserPool.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/TestPerUserPool.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/userpool/TestPerUserPool.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -25,17 +25,20 @@
 import java.io.Serializable;
 import java.util.Properties;
 
-import junit.framework.TestCase;
+import javax.sql.DataSource;
 
 import org.mockito.Mockito;
 
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.CredentialMap;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.internal.ConnectorPropertyNames;
+import com.metamatrix.connector.jdbc.JDBCConnector;
 import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.jdbc.JDBCSourceConnectionFactory;
 import com.metamatrix.dqp.internal.datamgr.impl.ExecutionContextImpl;
 
 /**
@@ -50,10 +53,12 @@
     
     public void testWrongCredentials() throws Exception {
         ConnectorEnvironment env = initConnectorEnvironment();
-        JDBCSourceConnectionFactory factory = new MockExampleConnectionFactory();
-        factory.initialize(env);
-        ExecutionContext ctx = createSecurityContext("pw1", false, factory); //$NON-NLS-1$
+        JDBCConnector factory = new JDBCConnector();
+        factory.setUseCredentialMap(true);
+        factory.setAdminConnectionsAllowed(false);
+        factory.start(env);
         try {
+            ExecutionContext ctx = createSecurityContext("pw1", false, factory); //$NON-NLS-1$
 			factory.getConnection(ctx);
 			fail("expected failure"); //$NON-NLS-1$
 		} catch (ConnectorException e) {
@@ -63,20 +68,14 @@
     
     private ConnectorEnvironment initConnectorEnvironment() throws Exception {
         final Properties connProps = new Properties();
-        connProps.put(JDBCPropertyNames.DRIVER_CLASS, "com.metamatrix.jdbc.oracle.OracleDriver"); //$NON-NLS-1$
+        connProps.put(JDBCPropertyNames.CONNECTION_SOURCE_CLASS, "com.metamatrix.jdbc.oracle.OracleDriver"); //$NON-NLS-1$
         connProps.put(JDBCPropertyNames.URL, TEST_URL); 
         connProps.put(ConnectorPropertyNames.CONNECTOR_BINDING_NAME, "oracle system"); //$NON-NLS-1$
         connProps.put(JDBCPropertyNames.EXT_CAPABILITY_CLASS, "com.metamatrix.connector.jdbc.oracle.OracleCapabilities"); //$NON-NLS-1$
-        connProps.put(JDBCPropertyNames.EXT_CONNECTION_FACTORY_CLASS, "com.metamatrix.connector.jdbc.oracle.OracleUserIdentityConnectionFactory"); //$NON-NLS-1$
-        connProps.put(JDBCPropertyNames.EXT_SQL_TRANSLATOR_CLASS, "com.metamatrix.connector.jdbc.oracle.OracleSQLTranslator"); //$NON-NLS-1$
-        connProps.put(JDBCPropertyNames.EXT_RESULTS_TRANSLATOR_CLASS, "com.metamatrix.connector.jdbc.oracle.OracleResultsTranslator"); //$NON-NLS-1$
-        ConnectorEnvironment env = Mockito.mock(ConnectorEnvironment.class);
-        Mockito.stub(env.getConnectorName()).toReturn("oracle system"); //$NON-NLS-1$
-        Mockito.stub(env.getProperties()).toReturn(connProps);
-        return env;
+        return EnvironmentUtility.createEnvironment(connProps, false);
     }
     
-    private ExecutionContext createSecurityContext(String credentialsStr, boolean useMap, JDBCSourceConnectionFactory factory) throws Exception {
+    private ExecutionContext createSecurityContext(String credentialsStr, boolean useMap, JDBCConnector factory) throws Exception {
         Serializable credentials = credentialsStr;
     	if (useMap) {
     		credentials = CredentialMap.parseCredentials(credentialsStr);
@@ -90,28 +89,37 @@
     
     public void testCredentialMapInSessionPayload() throws Exception {
         ConnectorEnvironment env = initConnectorEnvironment();
-        JDBCSourceConnectionFactory factory = new MockExampleConnectionFactory();
-        factory.initialize(env);
+        JDBCConnector factory = new JDBCConnector() {
+        	@Override
+        	public DataSource getDataSource() {
+        		return Mockito.mock(DataSource.class);
+        	}
+        };
+        factory.setUseCredentialMap(true);
+        factory.setAdminConnectionsAllowed(false);
+        factory.setConnectorName("oracle system");
+        factory.start(env);
         
         ExecutionContext ctx = createSecurityContext("(system=oracle system,user=bqt2,password=mm)", true, factory); //$NON-NLS-1$
-        MockSourceConnection conn = (MockSourceConnection)factory.getConnection(ctx);
-        assertEquals("bqt2", conn.getUser()); //$NON-NLS-1$
-        assertEquals("mm", conn.getPassword()); //$NON-NLS-1$
+        factory.getConnection(ctx);
     }
     
     public void testCredentialMapMissingSystem() throws Exception {
         ConnectorEnvironment env = initConnectorEnvironment();
-        JDBCSourceConnectionFactory factory = new MockExampleConnectionFactory();
-        factory.initialize(env);
+        JDBCConnector factory = new JDBCConnector();
+        factory.setUseCredentialMap(true);
+        factory.setAdminConnectionsAllowed(false);
+        factory.setConnectorName("oracle system");
+        factory.start(env);
 
         // Set system to "x" instead of "oracle system" which will cause no credentials to be found
-        ExecutionContext ctx = createSecurityContext("(system=x,user=bqt2,password=mm)", true, factory); //$NON-NLS-1$
         try {
+            ExecutionContext ctx = createSecurityContext("(system=x,user=bqt2,password=mm)", true, factory); //$NON-NLS-1$
             factory.getConnection(ctx);
             fail("Expected exception when creating connection with missing system credentials"); //$NON-NLS-1$
         } catch(Exception e) {
             // expected
-            assertEquals("Required connection property \"user\" missing for system \"oracle system\".", e.getMessage()); //$NON-NLS-1$
+            assertEquals("Payload missing credentials for oracle system", e.getMessage()); //$NON-NLS-1$
         }
     }
 

Modified: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util/TestFunctionReplacementVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util/TestFunctionReplacementVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util/TestFunctionReplacementVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -28,7 +28,7 @@
 import junit.framework.TestCase;
 
 import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.extension.impl.DropFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
 import com.metamatrix.connector.language.ICommand;
 
 /**

Modified: trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java
===================================================================
--- trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -39,12 +39,11 @@
 import com.metamatrix.connector.language.IQuery;
 import com.metamatrix.connector.language.IQueryCommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 
 /** 
  * Represents a connection to an LDAP data source. 
  */
-public class LDAPConnection extends BasicConnection implements PoolAwareConnection {  
+public class LDAPConnection extends BasicConnection {  
 
 	// Standard Connection data members
 	private ConnectorLogger logger;

Modified: trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Connector.java
===================================================================
--- trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Connector.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Connector.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -34,10 +34,10 @@
 import com.metamatrix.connector.api.CredentialMap;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.ConnectorAnnotations.ConnectionPooling;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
-import com.metamatrix.connector.pool.SingleIdentityFactory;
-import com.metamatrix.connector.pool.UserIdentityFactory;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
+import com.metamatrix.connector.identity.SingleIdentityFactory;
+import com.metamatrix.connector.identity.UserIdentityFactory;
 import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
 
 @ConnectionPooling

Modified: trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
===================================================================
--- trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -33,7 +33,6 @@
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.IQueryCommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 import com.metamatrix.connector.salesforce.Messages;
 import com.metamatrix.connector.salesforce.connection.impl.ConnectionImpl;
 import com.metamatrix.connector.salesforce.execution.DataPayload;
@@ -41,7 +40,7 @@
 import com.metamatrix.connector.salesforce.execution.UpdateExecutionParent;
 import com.sforce.soap.partner.QueryResult;
 
-public class SalesforceConnection extends BasicConnection implements PoolAwareConnection {
+public class SalesforceConnection extends BasicConnection {
 
 	private ConnectorEnvironment connectorEnv;
 	private ConnectionImpl connection;

Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -35,13 +35,12 @@
 import com.metamatrix.connector.object.extension.IObjectSource;
 import com.metamatrix.connector.object.extension.ISourceTranslator;
 import com.metamatrix.connector.object.util.ObjectConnectorUtil;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 import com.metamatrix.core.util.ArgCheck;
 
 /**
  * Implementation of Connection interface for Object connection.
  */
-public class ObjectConnection extends BasicConnection implements PoolAwareConnection {
+public class ObjectConnection extends BasicConnection {
     
 //    private static final String DEFAULT_TRANSLATOR = "com.metamatrix.connector.object.extension.source.BasicSourceTranslator";//$NON-NLS-1$
     

Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnector.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnector.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnector.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,9 +29,9 @@
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ConnectorLogger;
 import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
 import com.metamatrix.connector.object.util.ObjectConnectorUtil;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
 
 /**
  * Implmentation of the connector interface.

Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/SourceConnectionFactory.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/SourceConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/SourceConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -4,9 +4,8 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.SingleIdentity;
-import com.metamatrix.connector.pool.UserIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.SingleIdentity;
 
 public interface SourceConnectionFactory {
 	
@@ -30,7 +29,7 @@
      * Create an identity object based on a security context.  This method determines
      * how different security contexts are treated within the connection pool.  For 
      * example, using a {@link SingleIdentity} specifies that ALL contexts are treated
-     * equally and thus use the same pool.  A {@link UserIdentity} specifies that contexts
+     * equally and thus use the same pool.  A {@link CredentialMapIdentity} specifies that contexts
      * are differentiated based on user name, thus creating a per-user pool of connections.
      * Implementors of this class may use a different implementation of the 
      * {@link ConnectorIdentity} interface to similarly affect pooling. 

Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BaseSourceConnectionFactory.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BaseSourceConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BaseSourceConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -28,11 +28,11 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.SingleIdentity;
 import com.metamatrix.connector.object.ObjectConnection;
 import com.metamatrix.connector.object.SourceConnectionFactory;
 import com.metamatrix.connector.object.extension.IObjectSource;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.SingleIdentity;
 
 /**
  * Represents a base factory class for the creation of the source connection.  Subclasses
@@ -60,7 +60,7 @@
 
     
     /** 
-     * @see com.metamatrix.data.pool.SourceConnectionFactory#createConnection(com.metamatrix.connector.pool.ConnectorIdentity)
+     * @see com.metamatrix.data.pool.SourceConnectionFactory#createConnection(com.metamatrix.connector.identity.ConnectorIdentity)
      * @since 4.3
      */
     public final Connection createConnection(ConnectorIdentity id) throws ConnectorException {
@@ -81,7 +81,7 @@
      * @since 4.3
      */
     public ConnectorIdentity createIdentity(ExecutionContext context) throws ConnectorException {
-        return new SingleIdentity(context);
+        return new SingleIdentity();
     }
     
 }

Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -24,7 +24,7 @@
 
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILiteral;

Deleted: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialResultsTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialResultsTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialResultsTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- * Created on Mar 20, 2004 To change the template for this generated file go to Window&gt;Preferences&gt;Java&gt;Code
- * Generation&gt;Code and Comments
- */
-package com.metamatrix.connector.jdbc.oracle.spatial;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.connector.jdbc.oracle.OracleResultsTranslator;
-
-public class OracleSpatialResultsTranslator extends OracleResultsTranslator {
-
-    private List translators;
-
-    public OracleSpatialResultsTranslator() {
-        ArrayList translators = new ArrayList();
-        if (super.getValueTranslators() != null) {
-            translators.addAll(super.getValueTranslators());
-        }
-    }
-
-    public List getValueTranslators() {
-        return translators;
-    }
-
-}
\ No newline at end of file

Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -30,7 +30,7 @@
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.extension.SQLTranslator;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ICriteria;
 import com.metamatrix.connector.language.IFunction;
@@ -39,7 +39,7 @@
 import com.metamatrix.connector.language.ISelectSymbol;
 import com.metamatrix.connector.visitor.util.CollectorVisitor;
 
-public class OracleSpatialSQLTranslator extends SQLTranslator {
+public class OracleSpatialSQLTranslator extends Translator {
 
 	@Override
 	public void initialize(ConnectorEnvironment env) throws ConnectorException {

Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -72,7 +72,6 @@
 public class EmbeddedDataService extends EmbeddedBaseDQPService implements DataService {
     private static final String SYSTEM_PHYSICAL_MODEL_CONNECTOR_BINDING_CLASSNAME = "com.metamatrix.dqp.embedded.services.DefaultIndexConnectorBinding";     //$NON-NLS-1$
     private static final String CONNECTOR_MGR_IMPL = "com.metamatrix.dqp.internal.datamgr.impl.ConnectorManager"; //$NON-NLS-1$    
-    private static final String CONNECTOR_CLASSPATH = "ConnectorClassPath"; //$NON-NLS-1$
     
     // Map of connector binding name to ConnectorID
     private Map connectorIDs = new HashMap();
@@ -562,34 +561,26 @@
         throws ApplicationLifecycleException{
 
         try {
-            ConnectorManager mgr = null;
             // Ask the configuration if we can use the extension class loader. 
             boolean useExtensionClassPath = (getConfigurationService().useExtensionClasspath());        
-            String classPath = connectorProperties.getProperty(CONNECTOR_CLASSPATH);
+            String classPath = connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH);
             if (classPath == null || classPath.length() == 0) {
                 useExtensionClassPath = false;
             }
             
             if (!useExtensionClassPath) {
-            	connectorProperties.setProperty(ConnectorPropertyNames.DEREGISTER_DRIVER, ConnectorPropertyNames.DEREGISTER_BY_CLASSNAME);
-                mgr = new ConnectorManager();
+                return new ConnectorManager();
             }
-            else {
-                DQPEmbeddedPlugin.logInfo("DataService.useClassloader", new Object[] {classPath}); //$NON-NLS-1$
-                URL context = getConfigurationService().getExtensionPath();
-                URL[] urlPath = ExtensionModuleReader.resolveExtensionClasspath(classPath, context);
-                
-                ClassLoader classLoader = new URLFilteringClassLoader(urlPath, Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
-                Class cmgrImplClass = classLoader.loadClass(CONNECTOR_MGR_IMPL);
-                
-                // Here even though we use a new class loader for the CM, we actually setting the
-                // class loader for the JDBC Connectors. Since the CM may already be loaded, getClass().getCL()
-                // will return a another CL than, above so to cheat we do this below property.
-                connectorProperties.put(ConnectorPropertyNames.CONNECTOR_CLASS_LOADER, classLoader);
-                
-                return (ConnectorManager)cmgrImplClass.newInstance();                    
-            }
-            return mgr;
+            DQPEmbeddedPlugin.logInfo("DataService.useClassloader", new Object[] {classPath}); //$NON-NLS-1$
+            URL context = getConfigurationService().getExtensionPath();
+            URL[] urlPath = ExtensionModuleReader.resolveExtensionClasspath(classPath, context);
+            
+            ClassLoader classLoader = new URLFilteringClassLoader(urlPath, Thread.currentThread().getContextClassLoader(), new MetaMatrixURLStreamHandlerFactory());
+            Class cmgrImplClass = classLoader.loadClass(CONNECTOR_MGR_IMPL);
+            
+            ConnectorManager cm = (ConnectorManager)cmgrImplClass.newInstance();
+            cm.setClassloader(classLoader);
+            return cm;
         } catch (Exception e) {
             throw new ApplicationLifecycleException(e);
         }

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorManager.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -61,7 +61,9 @@
 import com.metamatrix.connector.internal.ConnectorPropertyNames;
 import com.metamatrix.connector.xa.api.XAConnection;
 import com.metamatrix.connector.xa.api.XAConnector;
+import com.metamatrix.core.MetaMatrixCoreException;
 import com.metamatrix.core.util.Assertion;
+import com.metamatrix.core.util.ReflectionHelper;
 import com.metamatrix.core.util.StringUtil;
 import com.metamatrix.dqp.DQPPlugin;
 import com.metamatrix.dqp.internal.cache.ResultSetCache;
@@ -338,17 +340,21 @@
      */
     private void initStartConnector(String connectorName, ConnectorEnvironment env) throws ApplicationLifecycleException {
         String connectorClassName = env.getProperties().getProperty(ConnectorPropertyNames.CONNECTOR_CLASS);
-        classloader = (ClassLoader)props.get(ConnectorPropertyNames.CONNECTOR_CLASS_LOADER);
         if(classloader == null){
             classloader = getClass().getClassLoader();
+        } else {
+        	env.getProperties().setProperty(ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER, Boolean.TRUE.toString());
         }
         Thread currentThread = Thread.currentThread();
         ClassLoader threadContextLoader = currentThread.getContextClassLoader();
         try {
         	currentThread.setContextClassLoader(classloader);
-        	Class<?> clazz = classloader.loadClass(connectorClassName);
-
-        	Connector c = (Connector) clazz.newInstance();
+        	Connector c;
+			try {
+				c = (Connector)ReflectionHelper.create(connectorClassName, null, classloader);
+			} catch (MetaMatrixCoreException e) {
+	            throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_find_Connector_class", connectorClassName)); //$NON-NLS-1$
+			}
             if(c instanceof XAConnector){
             	this.isXa = true;
                 if (this.getTransactionService() == null) {                    
@@ -371,15 +377,21 @@
             if (this.isXa) {
                 if (this.connector.supportsSingleIdentity()) {
                 	// add this connector as the recovery source
-					final XAConnection xaConn = ((XAConnector)connector).getXAConnection(null, null);
-
 	                TransactionServer ts = this.getTransactionService().getTransactionServer(); 
 	                ts.registerRecoverySource(connectorName, new TransactionProvider.XAConnectionSource() {
-
+	                	XAConnection conn = null;
+	                	
 	                	@Override
 	                	public XAResource getXAResource() throws SQLException {
+	                		if (conn == null) {
+	                			try {
+									conn = ((XAConnector)connector).getXAConnection(null, null);
+								} catch (ConnectorException e) {
+									throw new SQLException(e);
+								}
+	                		}
 	                		try {
-								return xaConn.getXAResource();
+								return conn.getXAResource();
 							} catch (ConnectorException e) {
 								throw new SQLException(e);
 							}
@@ -387,19 +399,15 @@
 	                	
 	                	@Override
 	                	public void close() {
-	                		xaConn.close();
+	                		if (conn != null) {
+	                			conn.close();
+	                		}
 	                	}
 	                });
                 } else {
                 	LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorManager.cannot_add_to_recovery", this.getName())); //$NON-NLS-1$	                
                 }
             }
-        } catch (InstantiationException e) {
-            throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_instantiate_Connector_class", new Object[]{connectorClassName})); //$NON-NLS-1$
-        } catch (IllegalAccessException e) {
-            throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_access_Connector_class", new Object[]{connectorClassName})); //$NON-NLS-1$
-        } catch (ClassNotFoundException e) {
-            throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_find_Connector_class", connectorClassName)); //$NON-NLS-1$
         } catch (ConnectorException e) {
             throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_start_Connector", new Object[] {this.getConnectorID(), e.getMessage()})); //$NON-NLS-1$
         } finally {
@@ -609,6 +617,10 @@
 		return isXa;
 	}
 	
+	public void setClassloader(ClassLoader classloader) {
+		this.classloader = classloader;
+	}
+	
 	/**
 	 * Overloads the connector capabilities with one defined in the connector binding properties
 	 */

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWrapper.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWrapper.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWrapper.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -28,9 +28,9 @@
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
-import com.metamatrix.connector.pool.SingleIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
+import com.metamatrix.connector.identity.SingleIdentity;
 import com.metamatrix.connector.xa.api.TransactionContext;
 import com.metamatrix.connector.xa.api.XAConnection;
 import com.metamatrix.connector.xa.api.XAConnector;
@@ -116,7 +116,7 @@
 		if (actualConnector instanceof ConnectorIdentityFactory) {
 			return ((ConnectorIdentityFactory)actualConnector).createIdentity(context);
 		}
-		return new SingleIdentity(context);
+		return new SingleIdentity();
 	}
 	
 	public boolean supportsSingleIdentity() {

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ExecutionContextImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ExecutionContextImpl.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ExecutionContextImpl.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,7 +29,7 @@
 
 import com.metamatrix.common.buffer.impl.BufferConfig;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentity;
 import com.metamatrix.core.util.HashCodeUtil;
 
 /**

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionPool.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionPool.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionPool.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -43,9 +43,9 @@
 import com.metamatrix.connector.api.Connection;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.PoolAwareConnection;
-import com.metamatrix.connector.pool.SingleIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.PoolAwareConnection;
+import com.metamatrix.connector.identity.SingleIdentity;
 import com.metamatrix.connector.xa.api.TransactionContext;
 import com.metamatrix.connector.xa.api.XAConnector;
 import com.metamatrix.core.log.MessageLevel;
@@ -208,7 +208,7 @@
         	id = executionContext.getConnectorIdentity();
         }
         if (id == null) {
-        	id = new SingleIdentity(executionContext);
+        	id = new SingleIdentity();
         }
                 
         LogManager.logTrace(CTX_CONNECTOR, new Object[] {"Obtaining connection for id", id}); //$NON-NLS-1$ 

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionWrapper.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionWrapper.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/ConnectionWrapper.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,10 +29,10 @@
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.Execution;
 import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.PoolAwareConnection;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.PoolAwareConnection;
 import com.metamatrix.connector.xa.api.XAConnection;
 
 public class ConnectionWrapper implements PoolAwareConnection, XAConnection {
@@ -66,13 +66,11 @@
 		if (isDead) {
 			return false;
 		}
-		if (connection instanceof PoolAwareConnection) {
-			long now = System.currentTimeMillis();
-			if (now - lastTest > testInterval) {
-				boolean result = ((PoolAwareConnection)connection).isAlive();
-				lastTest = now; 
-				this.isDead = !result;
-			}
+		long now = System.currentTimeMillis();
+		if (now - lastTest > testInterval) {
+			boolean result = connection.isAlive();
+			lastTest = now; 
+			this.isDead = !result;
 		}
 		return !isDead;
 	}

Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -341,7 +341,15 @@
 
         // Invoke the method and return the result
         try {
-            return method.invoke(null, values);
+            Object result = method.invoke(null, values);
+            if (result instanceof String) {
+            	String str = (String)result;
+    			if (str.length() > DataTypeManager.MAX_STRING_LENGTH) {
+    				return str.substring(0, DataTypeManager.MAX_STRING_LENGTH);
+    			}
+    			return result;
+            } 
+            return DataTypeManager.convertToRuntimeType(result);
         } catch(InvocationTargetException e) {
             throw new FunctionExecutionException(e.getTargetException(), ErrorMessageKeys.FUNCTION_0003, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0003, fd.getName()));
         } catch(IllegalAccessException e) {

Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1205,9 +1205,6 @@
 			for (int i = 0; i < repeatCount && result.length() <= DataTypeManager.MAX_STRING_LENGTH; i++) {
 				result.append((String)str);
 			}
-			if (result.length() > DataTypeManager.MAX_STRING_LENGTH) {
-				return result.substring(0, DataTypeManager.MAX_STRING_LENGTH);
-			}
 			return result.toString();
 		}
 

Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -137,7 +137,6 @@
     	ConnectorManager cm = new ConnectorManager();
         Properties props = new Properties();
         props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
-        props.put(ConnectorPropertyNames.CONNECTOR_CLASS_LOADER, this.getClass().getClassLoader());
         startConnectorManager(cm, props);
         assertTrue(cm.isXa());
         cm.stop();
@@ -154,7 +153,6 @@
         final String connectorName = FakeConnector.class.getName();
         props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, connectorName);//$NON-NLS-1$
         URLClassLoader cl = new URLClassLoader(new URL[0]);
-        props.put(ConnectorPropertyNames.CONNECTOR_CLASS_LOADER, cl);
         startConnectorManager(cm, props);
         ((FakeConnector)cm.getConnector().getActualConnector()).setClassloader(cl);
         AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);

Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -26,9 +26,9 @@
 
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.ConnectorIdentity;
-import com.metamatrix.connector.pool.ConnectorIdentityFactory;
-import com.metamatrix.connector.pool.UserIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentity;
+import com.metamatrix.connector.identity.ConnectorIdentityFactory;
+import com.metamatrix.connector.identity.UserIdentity;
 
 /**
  */
@@ -42,7 +42,7 @@
         	return null;
         }
     	//use user name for now
-        return new UserIdentity(context);
+        return new UserIdentity(context.getUser(), null, null);
     }
     
 }

Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionPool.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionPool.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionPool.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -29,7 +29,7 @@
 import junit.framework.TestCase;
 
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.pool.UserIdentity;
+import com.metamatrix.connector.identity.UserIdentity;
 import com.metamatrix.dqp.internal.datamgr.impl.ConnectorWrapper;
 import com.metamatrix.dqp.internal.datamgr.impl.ExecutionContextImpl;
 
@@ -69,7 +69,7 @@
     public static ExecutionContext createContext(final String user, boolean userIdentity) {
     	ExecutionContextImpl context = new ExecutionContextImpl(null, null, user, null, null, null, null, null, null, null, false);
     	if (userIdentity) {
-    		context.setConnectorIdentity(new UserIdentity(context));
+    		context.setConnectorIdentity(new UserIdentity(context.getUser(), null, null));
     	}
     	return context;
     }

Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionWrapper.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionWrapper.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/pooling/connector/TestConnectionWrapper.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -27,7 +27,7 @@
 import org.mockito.Mockito;
 
 import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.pool.PoolAwareConnection;
+import com.metamatrix.connector.identity.PoolAwareConnection;
 
 public class TestConnectionWrapper extends TestCase {
 

Modified: trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -245,8 +245,8 @@
             String connID = id.getVMControllerID().getID() + "|" + id.getID();         //$NON-NLS-1$
             deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_ID, connID);
             deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_BINDING_NAME, getInstanceName());
-            deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_CLASS_LOADER, loader);
             deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_VM_NAME, VMNaming.getVMName());
+            connectorManager.setClassloader(loader);
             connectorManager.initialize(deMaskedProps);
             return connectorManager;
             
@@ -263,7 +263,7 @@
         // Decrypt masked properties
         Properties deMaskedProps = decryptMaskedProperties(props);
 
-        String urls = deMaskedProps.getProperty(ConnectorServicePropertyNames.CONNECTOR_CLASS_PATH);
+        String urls = deMaskedProps.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH);
         
         ClassLoader loader = getCustomClassLoader(urls);
         // Build a Connector manager using the custom class loader and initialize

Deleted: trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorServicePropertyNames.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorServicePropertyNames.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorServicePropertyNames.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- * Date: Sep 25, 2003
- * Time: 4:38:45 PM
- */
-package com.metamatrix.server.connector.service;
-
-/**
- * ConnectorServicePropertyNames.
- */
-public class ConnectorServicePropertyNames {
-
-    /**
-     * Don't allow instantiation.
-     */
-    private ConnectorServicePropertyNames() {
-    }
-
-    /** Metadata service - provides acecss to runtime metadata */
-    public static final String METADATA_SERVICE = "dqp.metadata"; //$NON-NLS-1$
-    
-    public static final String CONNECTOR_CLASS_PATH = "ConnectorClassPath"; //$NON-NLS-1$
-}

Modified: trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -33,6 +33,9 @@
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.jdbc.JDBCPropertyNames;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ILanguageObject;
@@ -115,7 +118,7 @@
     private String getStringWithContext(ILanguageObject obj) throws ConnectorException {
         Properties props = new Properties();      
         props.setProperty(JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, Boolean.TRUE.toString());
-        SQLTranslator trans = new SQLTranslator();
+        Translator trans = new Translator();
         trans.initialize(EnvironmentUtility.createEnvironment(props, false));
         SQLConversionVisitor visitor = new SQLConversionVisitor(trans);
         visitor.setExecutionContext(context);
@@ -136,7 +139,7 @@
                                             boolean useMetadata, boolean usePreparedStatement) throws ConnectorException {
         // Apply function replacement
         FunctionReplacementVisitor funcVisitor = new FunctionReplacementVisitor(modifiers);
-        SQLTranslator trans = new SQLTranslator();
+        Translator trans = new Translator();
         Properties p = new Properties();
         if (usePreparedStatement) {
         	p.setProperty(JDBCPropertyNames.USE_BIND_VARIABLES, Boolean.TRUE.toString());

Modified: trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java	2009-02-23 17:43:19 UTC (rev 481)
@@ -34,8 +34,8 @@
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.jdbc.extension.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.extension.TranslatedCommand;
+import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
+import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;

Modified: trunk/test-integration/src/test/resources/xml-vp/xmlvp.DEF
===================================================================
--- trunk/test-integration/src/test/resources/xml-vp/xmlvp.DEF	2009-02-23 16:17:44 UTC (rev 480)
+++ trunk/test-integration/src/test/resources/xml-vp/xmlvp.DEF	2009-02-23 17:43:19 UTC (rev 481)
@@ -45,115 +45,37 @@
         <Property Name="MultiSourceEnabled" Value="false" />
     </Model>
     <ComponentTypes>
-        <ComponentType Name="Oracle ANSI JDBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2005-07-22T07:17:46.906-06:00" CreatedBy="ConfigurationStartup" CreationDate="2005-07-22T07:17:46.906-06:00">
+        <ComponentType Name="Loopback Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" LastChangedDate="2005-07-21T10:07:40.921-06:00" CreatedBy="ConfigurationStartup" CreationDate="2005-07-21T10:07:40.921-06:00">
             <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.JDBCConnector" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+                <PropertyDefinition Name="CapabilitiesClass" DisplayName="Capabilities Class" ShortDescription="" DefaultValue="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
             </ComponentTypeDefn>
             <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="com.metamatrix.data.pool.enable_shrinking" DisplayName="Pool Shrinking Enabled" ShortDescription="Set whether to enable the pool shrinking" DefaultValue="true" Multiplicity="0..1" PropertyType="Boolean" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+                <PropertyDefinition Name="ConnectorClass" DisplayName="Connector Class" ShortDescription="" DefaultValue="com.metamatrix.connector.loopback.LoopbackConnector" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
             </ComponentTypeDefn>
             <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="com.metamatrix.data.pool.max_connections_for_each_id" DisplayName="Pool Maximum Connections for Each ID" ShortDescription="Set the maximum number of connections for each connector ID for the connection pool" DefaultValue="20" Multiplicity="1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+                <PropertyDefinition Name="RowCount" DisplayName="Rows Per Query" ShortDescription="" DefaultValue="1" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
             </ComponentTypeDefn>
             <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ExtensionConnectionFactoryClass" DisplayName="Extension Connection Factory Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.oracle.OracleSingleIdentityConnectionFactory" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+                <PropertyDefinition Name="WaitTime" DisplayName="Max Random Wait Time" ShortDescription="" DefaultValue="0" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
             </ComponentTypeDefn>
             <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="Driver" DisplayName="Driver Class" ShortDescription="" DefaultValue="com.metamatrix.jdbc.oracle.OracleDriver" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+                <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:loopbackconn.jar;extensionjar:jdbcconn.jar" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
             </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ResultSetCacheScope" DisplayName="ResultSet Cache Scope" ShortDescription="" DefaultValue="vdb" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false">
-                    <AllowedValue>vdb</AllowedValue>
-                    <AllowedValue>session</AllowedValue>
-                </PropertyDefinition>
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="DatabaseTimeZone" DisplayName="Database time zone" ShortDescription="Time zone of the database, if different than MetaMatrix Server" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ExtensionResultsTranslationClass" DisplayName="Extension Results Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.oracle.OracleResultsTranslator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ExtensionSQLTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.oracle.OracleSQLTranslator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ResultSetCacheMaxAge" DisplayName="ResultSet Cache Maximum Age" ShortDescription="" DefaultValue="0" Multiplicity="0..1" PropertyType="Long" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" DefaultValue="extensionjar:MJjdbc.jar;extensionjar:jdbcconn.jar" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ExtensionCapabilityClass" DisplayName="Extension Capability Class" ShortDescription="" DefaultValue="com.metamatrix.connector.jdbc.oracle.OracleCapabilities" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mmx:oracle://&lt;host&gt;:1521;SID=&lt;sid&gt;" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="com.metamatrix.data.pool.wait_for_source_time" DisplayName="Pool Connection Waiting Time" ShortDescription="Set the time to wait if the connection is not available" DefaultValue="120000" Multiplicity="0..1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="com.metamatrix.data.pool.live_and_unused_time" DisplayName="Pool Connection Idle Time" ShortDescription="Set the idle time of the connection before it should be closed if pool shrinking is enabled" DefaultValue="60" Multiplicity="0..1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="Password" DisplayName="Password" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="com.metamatrix.data.pool.max_connections" DisplayName="Pool Maximum Connections" ShortDescription="Set the maximum number of connections for the connection pool" DefaultValue="20" Multiplicity="1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="User" DisplayName="User Name" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="TrimStrings" DisplayName="Trim string flag" ShortDescription="" DefaultValue="false" Multiplicity="0..1" PropertyType="Boolean" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ResultSetCacheMaxSize" DisplayName="ResultSet Cache Maximum Size" ShortDescription="" DefaultValue="0" Multiplicity="0..1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="com.metamatrix.data.pool.cleaning_interval" DisplayName="Pool cleaning Interval" ShortDescription="Set the interval to cleaning the pool" DefaultValue="60" Multiplicity="0..1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="TransactionIsolationLevel" DisplayName="Transaction Isolation Level" ShortDescription="Set the data source transaction isolation level" DefaultValue="" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="MaxSQLLength" DisplayName="Max SQL String Length" ShortDescription="" DefaultValue="16384" Multiplicity="0..1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="SetCriteriaBatchSize" DisplayName="SetCriteria Batch Size" ShortDescription="Max number of values in a SetCriteria before batching into multiple queries.  A value &lt;= 0 indicates batching is OFF." DefaultValue="0" Multiplicity="0..1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
-            <ComponentTypeDefn Deprecated="false">
-                <PropertyDefinition Name="ResultSetCacheEnabled" DisplayName="ResultSet Cache Enabled" ShortDescription="" DefaultValue="false" Multiplicity="0..1" PropertyType="Boolean" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
-            </ComponentTypeDefn>
         </ComponentType>
     </ComponentTypes>
     <ConnectorBindings>
-        <Connector Name="BQT2 Oracle 9i Simple Cap" ComponentType="Oracle ANSI JDBC Connector" LastChangedBy="metamatrixadmin" LastChangedDate="2005-07-22T10:04:46.156-06:00" CreatedBy="metamatrixadmin" CreationDate="2005-07-22T10:04:46.156-06:00" QueuedService="false" routingUUID="mmuuid:ed2688c1-5dee-1f92-9a22-c39c0fb66e36">
+        <Connector Name="BQT2 Oracle 9i Simple Cap" ComponentType="Loopback Connector" LastChangedBy="metamatrixadmin" LastChangedDate="2005-07-20T12:58:35.551-06:00" CreatedBy="metamatrixadmin" CreationDate="2005-07-20T11:39:55.961-06:00" QueuedService="false" routingUUID="mmuuid:a6ea7cc0-c651-1f91-940a-b13465b430eb">
             <Properties>
-                <Property Name="metamatrix.service.essentialservice">false</Property>
-                <Property Name="TransactionIsolationLevel" />
-                <Property Name="com.metamatrix.data.pool.max_connections">5</Property>
-                <Property Name="Password">mm</Property>
-                <Property Name="com.metamatrix.data.pool.cleaning_interval">60</Property>
-                <Property Name="com.metamatrix.data.pool.live_and_unused_time">60</Property>
-                <Property Name="User">bqt2</Property>
-                <Property Name="com.metamatrix.data.pool.enable_shrinking">false</Property>
-                <Property Name="TrimStrings">false</Property>
-                <Property Name="ExtensionCapabilityClass">com.metamatrix.connector.jdbc.oracle.OracleCapabilities</Property>
-                <Property Name="MaxSQLLength">16384</Property>
-                <Property Name="ConnectorClass">com.metamatrix.connector.jdbc.JDBCConnector</Property>
-                <Property Name="MaxResultRows">500000</Property>
-                <Property Name="URL">jdbc:mmx:oracle://slntds04:1521;SID=ds04</Property>
-                <Property Name="ExtensionConnectionFactoryClass">com.metamatrix.connector.jdbc.oracle.OracleSingleIdentityConnectionFactory</Property>
+                <Property Name="MaxResultRows">10000</Property>
                 <Property Name="ConnectorThreadTTL">120000</Property>
-                <Property Name="ServiceClassName">com.metamatrix.server.connector.service.ConnectorService</Property>
-                <Property Name="SetCriteriaBatchSize">0</Property>
-                <Property Name="com.metamatrix.data.pool.max_connections_for_each_id">5</Property>
                 <Property Name="ConnectorMaxThreads">5</Property>
-                <Property Name="ExtensionSQLTranslationClass">com.metamatrix.connector.jdbc.oracle.OracleSQLTranslator</Property>
-                <Property Name="ConnectorClassPath">extensionjar:MJjdbc.jar;extensionjar:jdbcconn.jar</Property>
-                <Property Name="com.metamatrix.data.pool.wait_for_source_time">120000</Property>
-                <Property Name="Driver">com.metamatrix.jdbc.oracle.OracleDriver</Property>
-                <Property Name="ExtensionResultsTranslationClass">com.metamatrix.connector.jdbc.oracle.OracleResultsTranslator</Property>
+                <Property Name="CapabilitiesClass" />
+                <Property Name="metamatrix.service.essentialservice">false</Property>
+                <Property Name="ConnectorClassPath">extensionjar:loopbackconn.jar</Property>
+                <Property Name="RowCount">1</Property>
+                <Property Name="ServiceClassName">com.metamatrix.server.connector.service.ConnectorService</Property>
+                <Property Name="ConnectorClass">com.metamatrix.connector.loopback.LoopbackConnector</Property>
+                <Property Name="WaitTime">0</Property>
             </Properties>
         </Connector>
     </ConnectorBindings>




More information about the teiid-commits mailing list